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

RE: deep "copy-of" a source fragment

Subject: RE: deep "copy-of" a source fragment
From: "Dion Houston" <dionh@xxxxxxxxxxxxx>
Date: Thu, 5 Sep 2002 01:03:46 -0700
xslt deep copy
Hey Terence:

> Dion, you are so spot on.

Gee, thanks! (I'm not sure if I know what this means, but I'll take it
as a compliment :) )

Here're some answers for your questions:

> what is the deal with "where" you declare the namespace? Does it
matter? 
> Must I do all my declarations in the root element? If not, must I do
all
> my declarations in the root stylesheet element if I want the XSL
processor > to match against them?

"Where" you declare the namespace doesn't matter, per se.  As long as it
is assigned previous in scope to anything referencing it, you're good.
In practice, to keep your XSLT readable, I'd suggest declaring it at
<xsl:stylesheet> so it's global in scope... i.e.

<xsl:stylesheet ... xmlns:html="...">
   <xsl:template match="html:body">

Will work just as well as:

<xsl:stylesheet ...>
   <xsl:template match="html:body" xmlns:html="...">

As for the namespace URI changing, you can actually consider this a
feature of XSLT.  Consider, for example, if a change to XHTML causes
something to break in your stylesheet because of a schema change...
Your script might break just as silently as it would for a namespace
change.  At least with a namespace change you can detect it:

<xsl:template match="/">
   <xsl:if test="not(/html:html)">
      <xsl:message fatal="yes">Could not find an HTML
document</xsl:message>
   </xsl:if>
</xsl:template>

This is one way you could make a stylesheet namespace tolerant.

In any case, if you have any more questions feel free to ask.

Dion 

 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.