RE: [xsl] xsl:for-each?

Subject: RE: [xsl] xsl:for-each?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Sun, 21 Jan 2001 23:24:09 -0000
> In the template I have:
>
>   <xsl:template match="markets">
>     <select name="Markets" size="1">
>       <xsl:for-each select="markets">
>         <option value="@id"/><xsl:value-of select="@name"/>
>       </xsl:for-each>
>     </select>
>   </xsl:template>
>

This template rule is called to process one particular <markets> element.
You xsl:for-each is then asking to process the <markets> elements that are
children of this <markets>, and there aren't any.

> Now, I know this isn't correct. I am confused as to why it
> doesn't work though.

No, your analysis seems to be quite correct...
> is it because the xsl node is
> already selected to "markets" that it is looking inside the
> first market node it comes across and isn't finding anything called
markets?

Yes (in effect - though your terminology is non-standard)

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread