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

Re: Name function in XSL

Subject: Re: Name function in XSL
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 8 May 2003 09:12:01 +0100
xsl element name function

> Here is a bit of code
> 
> <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>

Note you never need to start a match with // as it does not change the
elements matched, just the default priority.
Also using xsl:element and xsl:attribute makes it look a lot more
complicated than needed.

the above could be written

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


I don't see how it relates to teh original poter's question though,
which was about the name function.

Note also that you should not have elements named XmlNode in teh input
or XMLNode in the output as element names begining with x m l in any
case are reserved for use by W3C specifications according to the XML
spec.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


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.