|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Was test for presence of an attribute
On Fri, Jul 20 '01 at 12:39, val iliescu wrote:
> How would one go about to print the element names,
> followed imediately by their attribute name (if it
> exists ?)
That's easy: write a template that cataches all nodes (except text
nodes) and prints their (local) name, than does a for-each loop over all
attributes and print's this names. (And get yourselfe a good book)
It goes something along this lines (it produces recoverable errros with
saxon for the text nodes):
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!-- filename: test.xsl
created on: 2001 Jul 21 20:48:16 z (CEST)
last modified: 2001 Jul 21 21:00:23 z (CEST)
(c) 2001 by Goetz Bock <bock@xxxxxxxxxxx>
-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="node()">
<xsl:value-of select="name()" />
<xsl:text>: </xsl:text>
<xsl:for-each select="@*">
<xsl:value-of select="name()" />
</xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="text()" />
</xsl:transform>
--
Goetz Bock IT Consultant
Dipl.-Inf. Univ.
Attachment:
pgp00000.pgp
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








