Project

Profile

Help

How do I get distinct values and tokenize?

Added by Anonymous almost 17 years ago

Legacy ID: #4450319 Legacy Poster: Sharmila (sharmila)

I need to convert the following: <a type="epc">A01J7/02T;A01J7/04</a> <a type="ipc">A01J7/02; A01J7/00</a> <a type="ci">A01J7/02;A61D7/00;A61L2/10</a> to: <!-- tokenized/space-normalized values of element a with attribute EPC --> <EPCList> <EPC>A01J7/02T</EPC> <EPC>A01J7/04</EPC> </EPCList> <!-- tokenized/space-normalized distict-values of element a with attribute ipc and ci --> <IPCList> <IPC>A01J7/02</IPC> <IPC>A01J7/00</IPC> <IPC>A61D7/00</IPC> <IPC>A61L2/10</IPC> </IPCList> I have something working for tokenizing but when it comes to extracting distinct-values, I am stuck. Would appreciate any help.


Replies (1)

RE: How do I get distinct values and tokenize - Added by Anonymous almost 17 years ago

Legacy ID: #4450362 Legacy Poster: Michael Kay (mhkay)

XSLT coding questions are best raised on the xsl-list at mulberrytech.com; this forum is intended for issues specific to the Saxon product. As far as I can see the following should work: <xsl:for-each select="distinct-values(a[@type=('ipc', 'ci')]/tokenize(., ';'))"> <IPC><xsl:value-of select="."/></IPC> </xsl:for-each> Michael Kay http://www.saxonica.com/

    (1-1/1)

    Please register to reply