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

RE: XSL problem.

Subject: RE: XSL problem.
From: "Ross, Douglas" <DRoss@xxxxxxxxxx>
Date: Thu, 26 May 2005 16:41:04 -0400
fieldset stylesheet
It is helpful to also show the the desired output.

You might try these templates:

<xsl:template match="/">
<html>
  <body>
    <fieldset>
      <legend>
        <font face="verdana,arial,helvetica" size="+3" color="#00006B">
            <xsl:apply-templates select="//*" />
        </font>
      </legend>
    </fieldset>
  </body>
</html>
</xsl:template>

<xsl:template match="node()">
	<!-- output the name of the element -->
	<xsl:value-of select="name()" />
	<xsl:apply-templates select="@*" />
</xsl:template>

<xsl:template match="attribute()">
	<!-- output the name of the attribute -->
	<xsl:value-of select="name()" />
</xsl:template>

So the source xml:
<book>
<author age="" id="">
    <fisname/>
    <lastname/>
</author>
</book>

Would produce:
<html>
  <body>
    <fieldset>
      <legend>
        <font face="verdana,arial,helvetica" size="+3" color="#00006B">
bookauthorageidfirstnamelastname
        </font>
      </legend>
    </fieldset>
  </body>
</html>

I ran the transform through Saxon 8b.

Douglas Ross
Developer, HTML UI Framework
Kronos
www.kronos.com


-----Original Message-----
From: Frequent Fliers [mailto:frequent_fliers@xxxxxxxxxxx]
Sent: Thursday, May 26, 2005 4:17 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  XSL problem.

Hi firstly im really new to xsl + xpath. im using xsl on windows xp so
im
not sure what processor it is
:(
anyway, im trying to write an xsl file that will print out every element

name in an xml file as well as the attributes.
Presently im trying to print out the name of every element.i have the
following:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
version =
"1.0" >
<xsl:template match="/">
<html>
  <body>
    <fieldset>
      <legend>
        <font face="verdana,arial,helvetica" size="+3" color="#00006B">
            <xsl:apply-templates />
        </font>
      </legend>
    </fieldset>
      <xsl:apply-templates />
  </body>
</html>
</xsl:template>
  <xsl:template match="*">
    <xsl:value-of select="name()" />
  </xsl:template>
  <xsl:template match="*">
    <xsl:for-each select=".">
      <xsl:value-of select="name()" />
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
the first template prints out the root node name, which works.but for
the
second template all i get is the name of the root node again, but just
in
plain text, so its the second template.
here is my xml file.
<book>
<author age="" id="">
    <fisname/>
    <lastname/>
</author>
</book>
Please be aware that im trying to write the xslt file to work
generically
for any xml file.so im not aware of the names of any of the elements,
attributes or the presence of attributes for that matter.
Please help, im really stuck!
thank you very much.!

_________________________________________________________________
Winks & nudges are here - download MSN Messenger 7.0 today!
http://messenger.msn.co.uk

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.