[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl-element not allowed directly below xsl-stylesh
Since xsl:element is not a top level element,it cannot be a direct child of
xsl:stylesheet.
The following are top level elements ___________________ <xsl:attribute-set> <xsl:decimal-format> <xsl:include> <xsl:key match> <xsl:namespace-alias> <xsl:output> <xsl:param> <xsl:preserve-space> <xsl:strip-space> <xsl:template> <xsl:variable> ________________ So you should call <xsl:apply-templates> matching each of the form-elements within a <xsl:template> and then define the template with a corresponding match.. The following code will help you.. for example if your xml looks like <?xml version="1.0"?> <root> <form1>form1</form1> <form2>form2</form2> <form3>form3</form3> </root> Now your xsl would be.. <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="root"> <forms> <form1> <xsl:apply-templates select="form1"/> </form1> <xsl:element name="forms2-3"> <xsl:apply-templates select="form2|form3"/> </xsl:element> </forms> </xsl:template> <xsl:template match="form1"> <xsl:value-of select = "."/> </xsl:template> <xsl:template match="form2"> <xsl:value-of select = "."/> </xsl:template> <xsl:template match="form3"> <xsl:value-of select = "."/> </xsl:template> </xsl:stylesheet> the following is the result of the transformation.. <?xml version="1.0" encoding="UTF-16" ?> <forms> <form1>form1</form1> <forms2-3>form2form3</forms2-3> </forms> Hope this helps Vasu From: "Christer Nordvik" <christer.nordvik@xxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: xsl-element not allowed directly below xsl-stylesheet? Date: Tue, 13 Aug 2002 10:33:02 +0200 _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|