[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Was test for presence of an attribute

Subject: Re: Was test for presence of an attribute
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Sat, 21 Jul 2001 21:03:07 +0200
xsl test for presence
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.