xsl-list
[Top] [All Lists]

Re: [xsl] xpath query

2008-01-18 16:46:55
Hi there,
I am still struggling with mostof this stuff, but I have a question
related to the original data.

<ROOT>
    <LEVEL2>
        <B>
            <a>100</a>
            <b apply="1">100</b>
            <c>100</c>
        </B>
        <C>
            <a>100</a>
            <b>100</b>
            <c apply="1">100</c>
        </C>
        </LEVEL2>
</ROOT>

If I create the following stylesheet I get 100 100 output

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
    <xsl:template match="ROOT">
        <html>
            <xsl:value-of select="LEVEL2/*/*[(_at_)apply='1']"/>
        </html>
    </xsl:template>
</xsl:stylesheet>

What I am not clear on is why does this return values and not nodes?
Or is this really returning both nodes and I am getting the value of
each one because of the <xsl:value-of select="..."/> expression?

As far as I can figure the expression ROOT/LEVEL2/*/*[(_at_)apply='1']"
says give me the  nodes that have the arrtibute apply=1 and are
grandchildren of level2.

I kind of though to get both values I would have to do something like

<xsl:template match="ROOT">
      <xsl:for-each select="LEVEL2/*/*[(_at_)apply='1']">
           <xsl:value-of select="."/>
      </xsl:for-each>
</xsl:template>

Sorry if this seems really trivial but it helps me to better understand.

-- 
Thanks
Sean

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

<Prev in Thread] Current Thread [Next in Thread>