Subject: RE: [xsl] deep "copy-of" a source fragment From: "Dion Houston" <dionh@xxxxxxxxxxxxx> Date: Thu, 5 Sep 2002 01:03:46 -0700 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] deep "copy-of" a source f, Terence Kearns | Thread | RE: [xsl] Getting the XPath of a no, Jarno . Elovirta |
[xsl] Re: A few questions to the ex, Dimitre Novatchev | Date | RE: [xsl] A few questions to the ex, Michael Kay |
Month |