|
Subject: Re: [xsl] Was test for presence of an attribute From: Goetz Bock <bock@xxxxxxxxxxx> Date: Sat, 21 Jul 2001 21:03:07 +0200 |
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
Description: PGP signature
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Was test for presence of an a, val iliescu | Thread | RE: [xsl] Was test for presence of , Michael Kay |
| Re: [xsl] Why does using the XSL na, David Carlisle | Date | Re: [xsl] Why does using the XSL na, Aaron Hope |
| Month |