[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

Subject: Re: xsl-element not allowed directly below xsl-stylesheet?
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 13 Aug 2002 09:25:32 +0000
element not allowed
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

I have an XSL stylesheet that have the structure:

<xsl:stylesheet>

 <xsl:template match="form1">
	...
 </xsl:template>

 <xsl:template match="form2">
    	...
 </xsl:template>

 <xsl:template match="form3">
   	...
 </xsl:template>

</xsl:stylesheet>

And now I need an element tag that starts before form2 and ends after
form3. But when I try to include an <xsl:element> before the
<xsl:template> tag I get an error saying that <xsl:stylesheet> can't
contain <xsl:element> tags.

Is there any other way of specifying an element?

Best Regards,

Christer Nordvik



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




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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.