[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: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 13 Aug 2002 09:58:44 +0100
stylesh
Hi Christer,

> 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? 

The templates that you have in your stylesheet actually say very
little about the structure of your output (or your input). Each
template simply says "when you see an X, do Y". What determines the
structure of the output is the order in which you apply templates to
the elements in your source.

So, you haven't told us the structure of your source document, but I'm
guessing that it looks something like:

<forms>
  <form1>...</form1>
  <form2>...</form2>
  <form3>...</form3>
</forms>

In that case, to get an element that wraps the results of processing
the form2 and form3 elements, you need to create that element in a
template that matches the forms element -- you use that template to
structure the output of the stylesheet:

<xsl:template match="forms">
  <xsl:apply-templates select="form1" />
  <element>
    <xsl:apply-templates select="form2 | form3" />
  </element>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.