css - Get attribute of iterating element inside loop in xslt -



css - Get attribute of iterating element inside loop in xslt -

i want know how loop on attribute of looping element in xslt. have next xml structure:

<catalog> <cd v="1"> <title>empire burlesque</title> <artist>bob dylan</artist> <country>usa</country> <company>columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd v="2"> <title>hide heart</title> <artist>bonnie tyler</artist> <country>uk</country> <company>cbs records</company> <price>9.90</price> <year>1988</year> </cd>

and xslt follows:

<xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="../cd/@v"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each>

what happens xslt that, fetches attribute cd first tag only. rows value 1. how can iterate on other attribute values if there more elements? doing wrong?

instead of:

<xsl:value-of select="../cd/@v"/>

use simply:

<xsl:value-of select="@v"/>

css xml xslt xpath

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -