Subject: RE: [xsl] Namespaces in XSLT From: "Evan Lenz" <evan@xxxxxxxxxxxx> Date: Sat, 4 May 2002 19:51:07 -0700 |
tinku wrote: > Is the default namespaces taken into account when processing > XPATHs in an XSL stylesheet? What will be generated as the > following is given: I think you might be asking two different questions here: 1) Is the default namespace taken into account when evaluating XPath expressions (or match patterns) in an XSLT stylesheet? 2) Is the default namespace taken into account when creating an element with a literal result element? The answer to #1 is no. Looking at your example: > <xsl:template xmlns= "http://foo.com" match='bo[@xpath]'> > <foo/> > </xsl:template> This template rule will only match "bo" elements that are not in a namespace. If you want to match (or select) "bo" elements in a namespace, you must use a prefix and corresponding xmlns declaration. Note that, for the sake of convenience, XSLT 2.0 will provide a way to declare a default namespace for XPath expressions and XSLT patterns, in the form of an [xsl:]default-xpath-namespace attribute. See http://www.w3.org/TR/xslt20/#unprefixed-qnames The answer to #2 is yes. More accurately, the XSLT processor just takes the local/URI pair that the namespace-aware XML parser gives to it. In your example above, the <foo/> element name consists of the following local/URI pair: ("foo", "http://foo.com"). That is the name given to the created element in the result tree. Hope this helps, Evan XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Namespaces in XSLT, G. Ken Holman | Thread | [xsl] Re: Finding the lowest 'price, Dimitre Novatchev |
Re: [xsl] Namespaces in XSLT, G. Ken Holman | Date | Re: [xsl] xpath - how to return all, G. Ken Holman |
Month |