[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: xsl / xpath and namespaces
Subject: Re: xsl / xpath and namespaces|
From: Jeb Boniakowski <jeb@xxxxxxxxxxx>
Date: Sat, 15 Jan 2005 00:57:50 -0500
Never mind. Also already covered in dpawson and on jeni's site, so not
worth repeating here.
On Jan 14, 2005, at 8:48 PM, Jeb Boniakowski wrote:
Thanks to everyone for the very informative followups to my last post
(sorry about the busted subject line, Tommie). I took <xsl:template
match="text()"/> out of all of my sheets.
I'm having trouble with transformations involving namespaces though.
All of my xsl files begin with a preamble that I've till now
considered a magic incantation generated by my editor. It includes a
number of statements that assign namespaces to various prefixes like
xsl, xs, xn, xdt, etc. There is no assignment for the default
So I've been cruising along making xml docs and xsl transformations
with no xmlns= at all. I now realize I may have erred.
If I'm transforming one of my namespaceless docs with one of my
namespaceless sheets, everything is fine until I <xsl:apply-templates
select="document()"> a sheet with an xmlns="something" on its root
node. If I remove this attribute from the root node, all is well, but
that's more of a phenomenon than a solution.
I had assumed that this was simply a matter of matching the values of
xmlns in all my various documents' root nodes. I tried this but it
doesn't work. If I have:
and run it through:
I get my expected output of:
If I add:
xmlns="foo" to <root> and <stylesheet> though, I get:
The result of the default rules, I imagine.
I also tried changing the attribute on the stylesheet to
xpath-default-namespace="foo" because I thought 'hey, these Exprs are
all XPath, right?". That does nothing.
The only thing that seems to do what I want is to assign a foo prefix
in the namespace to the desired ns, and then prepending all the XPath
Exprs with foo:. This is not what I want to do though. I just want
my stylesheet and source docs to all be in the same namespace, with no
prepending of anything. The stylesheets are already written with all
the xsl tags prefixed with xsl: so I don't see how there's a potential
problem with namespace collision.
Thanks in advance for any help.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format