[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Should You Comment XSLT And If So, How?

Subject: RE: Should You Comment XSLT And If So, How?
From: David N Bertoni/Cambridge/IBM <david_n_bertoni@xxxxxxxxxx>
Date: Tue, 18 Feb 2003 23:09:03 -0800
xslt doc type



Ryan Gallagher <binerman@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Use XML TAGS in your xsl...
>
> <doc type="variable">
>   <desc>This variable is for X</desc>
> </doc>
> <xsl:variable name="foobar" select="Hello World!"/>
>
> <doc type="template">
>   <desc type="short">This template does foo.</desc>
>   <desc type="long">I'm the verbose desc...</desc>
> </doc>
> <xsl:template match="foo">
> ...
> </xsl:template>

Your example is illegal because top-level elements may not have a null
namespace URI:

   http://www.w3.org/TR/xslt#stylesheet-element

   "In addition, the xsl:stylesheet element may contain any element not
   from the XSLT namespace, provided that the expanded-name of the element
   has a non-null namespace URI. The presence of such top-level elements
   must not change the behavior of XSLT elements and functions defined in
   this document; for example, it would not be permitted for such a
   top-level element to specify that xsl:apply-templates was to use
   different rules to resolve conflicts. Thus, an XSLT processor is always
   free to ignore such top-level elements, and must ignore a top-level
   element without giving an error if it does not recognize the namespace
   URI."

> If you like you can even give your comments a namespace and DTD, but from
what
> i've read/understand anything not in the xsl namespace will be safely
ignored
> outside of templates.  Inside templates i'm not positive, but namespaces
would
> certainly resolve the conflicts.

Such elements inside templates won't work because they are literal result
elements and will be copied to the result tree:

<xsl:template match="/" xmlns:doc="http://mycompany.com/doc">
  <doc:doc type="something">
  </doc:doc>
</xsl:template>

Other top-level elements may not allow children, may restrict what sort of
children are allowed, or will consider elements not in the XSLT namespace
as literal result elements.

Dave


 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.