Subject: Re: [xsl] Using XSLT to build an index From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 31 Oct 2011 07:17:00 -0400 |
I have now normalized and isolated every phrase I wish to index into a few thousand structures similar to:
<Text lang="en" data="Zlutice Hymnal 1558" title="Czech Republic Stamp 664" ref="2010-664.htm"/>
and want to break the @data attribute string into into individual words associated with its title and ref attributes. How do I use "distinct-values(tokenize(@data))" to construct a sequence of <Word> elements from the <Text> element similar to the following? That is, I don't see how to get at the words returned from distinct-values(tokenize(@data)) one at a time to do this.
<Word title="Czech Republic Stamp 664" ref="2010-664.htm">Zlutice</Word> <Word title="Czech Republic Stamp 664" ref="2010-664.htm">Hymnal</Word> <Word title="Czech Republic Stamp 664" ref="2010-664.htm">1558</Word>
<xsl:variable name="title" select="@title"/> <xsl:variable name="ref" select="@ref"/> <!--walk over each distinct value setting that value as the current node--> <xsl:for-each select="distinct-values(........)"> <Word title="{$title}" ref="{$ref}"><xsl:value-of select="."/></Word> </xsl:for-each>
-- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using XSLT to build an in, Michael Kay | Thread | Re: [xsl] Using XSLT to build an in, Mark |
Re: [xsl] Using XSLT to build an in, Michael Kay | Date | Re: [xsl] Using XSLT to build an in, Mark |
Month |