Re: [xsl] Name function in XSL

Subject: Re: [xsl] Name function in XSL
From: "Simon Kelly" <kelly@xxxxxxxxxx>
Date: Thu, 8 May 2003 08:38:27 +0200
Here is a bit of code from Sal Mangano in the XSLT Cookbook, with a bit of
modification to create the XMLNode element.  Note that you will need to
modify the match statement to take into account for the numbers at the end
of the XmlNode element name (I don't use regxpr much and can never remember
the format off the top of my head :(  )

<xsl:template match="//XmlNode">
  <xsl:for-each select="*">
    <xsl:element name="XMLNode">
      <xsl:attribute name="Text">
        <xsl:value-of select="." />
      </xsl:attribute>
      <xsl:value-of select="anyOtherValue" />
    </xsl:element>
  </xsl:for-each>
<xsl:template>


Cheers

Simon


----- Original Message -----
From: "Molnar Agnes" <agi@xxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, May 08, 2003 10:21 AM
Subject: [xsl] Name function in XSL


Hello,

I'm a beginner in XSL, and I have a question.
I'd like create a new XML document from an other with XSL. In the new XML
I'd like nodes with name "XMLNode", and the XMLNode have an attribute
named "text", with value of the name of the first XML's nodes.
Like this:

In the original XML:
<XmlNode1>anyValue</xmlNode1>

It will be in the new XML:
<XMLNode Text="XmlNode1">anyOtherValue</node>

I think, the name() function can be OK for me, but I don't know, how can
use it. Do you have any idea, or a short code example?

Thanks for all,
Agnes



 Molnár Ágnes
-----------------------
 Web: http://aghy.uw.hu
 Icq: 167290967
 Tel: +36-20-212-8493


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread