-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 14 October 2002 14:28, you wrote:
I got fixated on attribute value templates
I guess that's a perfectly good thing to get confused about :) Sorry for
biting at you so hard.
I'm sure you've figured out the difference between attribute-value-templates
and the XPath attribute:: axis (abreviated as '@') by now.
<table>
<tr>
<!-- you can output the value of an attribute when you know the name -->
<td><xsl:value-of select="element/@attribute"/></td>
<!-- you can output unknown attributes -->
<xsl:for-each select="element/@*">
<td>
<!-- name of the current attribute -->
<xsl:value-of select="name()"/>
<xsl:text>=</xsl:text>
<!-- value of the current attribute -->
<xsl:value-of select="."/>
</td>
</xsl:for-each>
</tr>
</table>
Outputting the value of an attribute is different than an attribute value
template, which is a shortcut to using the <xsl:attribute> tag to create an
attribute in an element.
<foo>
<xsl:attribute name="bar">
<xsl:value-of select="/xyz/baz"/>
</xsl:attribute>
</foo>
which is the same thing as
<foo bar="{/xyz/baz}"/>
The point is, you only need attribute value templates and xsl:attribute if you
want to *create* attributes on an element in the *output* document. If you
just want to use the value of an attribute in the *source* document, use the
'element/@attribute' syntax.
- --
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9qzpLhDAgUT1yirARAvd0AJ0Xwev3NBDovuUXCK8q0MSJP0pBkQCgg+2T
eu0dYLJ8hv0j6/wttoNX3EM=
=yrBn
-----END PGP SIGNATURE-----
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list