Subject: RE: [xsl] create new elements as output From: "Kevin Jones" <kjouk@xxxxxxxxxxx> Date: Wed, 28 Mar 2001 11:47:18 +0100 |
> >Hi. I appreciate any help that anyone would like to offer. Thanks. >Problem: Using XSL in trying to transform XML file into another XML file >with differing element names and adding a group element. Use of "name" for >creating elements is ignored, and don't understand why. > There are a few problems with the stylesheet that you sent in. The namespace should have been "xmlns:xsl="http://www.w3.org/1999/XSL/Transform". This has been commented out in out version. The other namespace is for a Microsoft only version of XSL, see http://www.netcrucible.com/xslt/msxml-faq.htm for a description of the difference. The stylesheet element also needed a version="1.0" attribute to make it valid. The FareRules template was closing the 'Text' element before processing the other templates. This should do what you need. <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="FareRules"> <xsl:element name="Text"> <xsl:apply-templates select="PenRules"/> <xsl:apply-templates select="MinStay"/> <xsl:apply-templates select="MaxStay"/> </xsl:element> </xsl:template> <xsl:template match="PenRules"> <xsl:element name="PenaltyRules"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="MinStay"> <xsl:element name="MinimumStay"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="MaxStay"> <xsl:element name="MaximumStay"> <xsl:value-of select="."/> </xsl:element> </xsl:template> </xsl:stylesheet> Regards, Kev. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] create new elements as output, Bruce Rosborough | Thread | Re: [xsl] create new elements as ou, Larry_Mason |
RE: [xsl] xsl:include and xsl:other, Michael Kay | Date | [xsl] import value of xml-doc into , Kristof Bernaert |
Month |