xsl-list
[Top] [All Lists]

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

2008-04-28 14:04:25
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

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