Subject: Re: [xsl] Name function in XSL From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 8 May 2003 09:12:01 +0100 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Name function in XSL, Simon Kelly | Thread | Re: [xsl] Name function in XSL, Molnar Agnes |
RE: [xsl] Name function in XSL, Michael Kay | Date | Re: [xsl] Blank lines in xhtml when, David Carlisle |
Month |