[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Problem with iterating through a sequence of integers


Subject: RE: [xsl] Problem with iterating through a sequence of integers
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Mon, 28 Apr 2008 17:03:58 -0400

Hi Andrew,

> It seems an odd requirement (I've never needed to
> process a sequence in this way) - maybe you could
> define the requirements a little more fully?

I am creating a tutorial on XPath! (oddly enough)

To demonstrate how an XPath expression is evaluated, I have an XSLT
for-loop that iterates over each value in the sequence specified by the
XPath:

    <xsl:for-each select="XPath Expression">
       -- if the value is a node,
       -- then show the node; otherwise (it's
       -- an atomic value) show the atomic value.
    </xsl:for-each>

So, I tried to implement it like this:

    <xsl:for-each select="XPath Expression">
        <xsl:choose>
            <xsl:when test=". instance of node()">
                <xsl:apply-templates select="." />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:for-each>


/Roger


Current Thread
Keywords