Subject: Re: [xsl] How to access all attributes and their values ? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 01 Nov 2004 15:18:13 -0500 |
<xsl:template match="elem"> <xsl:for-each select="@*"> <xsl:text>
Attribute name=</xsl:text> <xsl:value-of select="name()"/> <xsl:text>Attribute value=</xsl:text> <xsl:value-of select="."/> </xsl:for-each> </xsl:template>
Cheers, Wendell
For a given node I want to list all its (unknown) attribute names and (unknown) attribute values.
How do I code this within an XSLT stylesheet? It should be something similar to:
XML doc: <elem myattr1="myval1" myattr2="myval2" myattr3="myval3">Dummy</elem>
XSLT: ... <xsl:for-each select="\\elem[@]"> Attribute name=<xsl:copy-of select="extractattrname(.)" /> Attribute value=<xsl:copy-of select="extarcteattrvalue(.)" /> </xsl:for-each>
should yield:
Attribute name=myattr1 Attribute value=myval1 Attribute name=myattr2 Attribute value=myval2 Attribute name=myattr3 Attribute value=myval3
Thomas
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to access all attributes , Matt Adams | Thread | Re: [xsl] How to access all attribu, J.Pietschmann |
RE: [xsl] Collapsing run-on tag cha, Michael Kay | Date | Re: [xsl] How to access all attribu, J.Pietschmann |
Month |