RE: [xsl] XSL problem.

Subject: RE: [xsl] XSL problem.
From: "Ross, Douglas" <DRoss@xxxxxxxxxx>
Date: Thu, 26 May 2005 16:41:04 -0400
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] 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