Re: [xsl] understanding attributes and predicates

Subject: Re: [xsl] understanding attributes and predicates
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: Fri, 01 Feb 2008 18:16:57 +0000
>>>>> "Terry" == Terry Ofner <tofner@xxxxxxxxxxx> writes:


    Terry> When I select specific par elements with a predicate, as in
    Terry> the template below, I get the attribute name, attribute
    Terry> value, and the text node of the <par> element.

    Terry> <xsl:template match="par[@class='stem_mc']"> <!-- List the
    Terry> attribute names and values. --> <xsl:for-each select='@*'>
    Terry> attribute name: <xsl:value-of select="name()"/> attribute
    Terry> value: <xsl:value-of select="."/> </xsl:for-each>
    Terry> </xsl:template>


    Terry> I just wonder what is going on. Is it the "for-each
    Terry> select='@*'" or the "value-of select="." that is returning
    Terry> the text node of the par element?

No.

You are not matching the par elements which DON'T have a
class="stem_mc' attribute. So these get matched by the built-in
templates, which just write the text nodes.

-- 
Colin Adams
Preston Lancashire

Current Thread