|
Subject: [xsl] Counting the number of elements within and outputting a variable holding analyze-string results wrapped by elements in a for-each From: Alex Muir <alex.g.muir@xxxxxxxxx> Date: Mon, 30 Nov 2009 13:35:08 +0000 |
Hi,
I'm interested in counting the number of elements in the variable
$varAnalyzeStr holding analyze-string results wrapped by elements and
then output the elements within the $varAnalyzeStr in a for-each.
I've been able to count the number accurately however not output the
variable varAnalyzeStr as a series of section elements. Currently I'm
looping 15 times in the for each but no outputting any content.
What am I doing wrong and is there a better way to do this?
<xsl:variable name="varAnalyzeStr" as="node()*">
<xsl:analyze-string select="parent::node()/content/text()"
regex="Y(\d+)Y">
<xsl:matching-substring>
<xsl:element name="section">
<xsl:attribute name="href" select="regex-group(1)"/>
</xsl:element>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(empty($varAnalyzeStr))">
<xsl:element name="">
<xsl:attribute name="Count" select="count($varAnalyzeStr)"/>
<xsl:for-each select="$varAnalyzeStr">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:when>
</xsl:choose>
--
Thanks Much
Alex
https://sites.google.com/a/utg.edu.gm/alex
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xslt:number numeration st, Michael Kay | Thread | Re: [xsl] Counting the number of el, Michael Müller-Hille |
| RE: [xsl] UTF character of ® an, Michael Kay | Date | Re: [xsl] Counting the number of el, Michael Müller-Hille |
| Month |