Subject: Re: [xsl] Transform param name to tagname in uppercase From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 01 Mar 2008 17:58:12 -0500 |
I have not been in touch with XSLT for a couple of years now and this simple transformation I can not describe in XSLT:
<params>
<param name="somename">value</param>
</params>
should be transformed to:
<INPUT> <SOMENAME>value</SOMENAME> </INPUT
So basically the parameter "name" should be transformed to a tag in the final XML.
Can anyone give me a starting point how to do that?
t:\ftemp>type phil.xml <params> <param name="somename">value</param> </params>
t:\ftemp>type phil.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="params"> <INPUT> <xsl:apply-templates/> </INPUT> </xsl:template>
<xsl:template match="param"> <xsl:element name="{upper-case(@name)}"> <xsl:apply-templates/> </xsl:element> </xsl:template>
</xsl:stylesheet> t:\ftemp>xslt2 phil.xml phil.xsl con <?xml version="1.0" encoding="UTF-8"?> <INPUT> <SOMENAME>value</SOMENAME> </INPUT> t:\ftemp>
-- World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Transform param name to tagna, phil . kursawe | Thread | RE: [xsl] Transform param name to t, Philipp Kursawe |
Re: [xsl] Help with XPath statement, G. Ken Holman | Date | RE: [xsl] Transform param name to t, Michael Kay |
Month |