xsl-list
[Top] [All Lists]

Re: [xsl] Counting the number of elements within and outputting a variable holding analyze-string results wrapped by elements in a for-each

2009-11-30 08:48:11
Alex Muir wrote:

<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>

Here you construct a 'section' element with 'href' attribute but not content.


          </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="."/>

Here you do value-of of those empty 'section' element. Maybe you want xsl:copy-of select="." to copy those elements to the result tree.


--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--