This is a FAQ about XSLT coding. XSLT coding questions should best be posted to the xsl-list at - this list is for questions specific to Saxon.
Try googling for "XSLT default namespace". As a quick fix you can probably simply add
to your xsl:stylesheet element. But I'd recommend not doing that without also reading up on it to understand what it means.
Michael Kay
PS. I just realized that I reacted rather negatively to your message, which was perhaps a bit unfair. It was your choice of language that triggered this reaction: the mild suggestion that your code was correct and Saxon was wrong, when in fact you have made one of the most common beginner's mistakes in the book. You might like to take this into account when posting to forums in future; if code is not doing what you intended then 9 times out of 10 the mistake is yours, and you get a more favourable reaction if you describe your problem in these terms.
By way of apology, let me offer two suggestions for improving your code:
(a) get rid of the "disable-output-escaping='yes'". There are very few occasions when you need to use d-o-e, and this isn't one of them. In fact, with output="text", XML escaping is never applied, so there is no reason to disable it.
(b) change
<xsl:variable name="Number"><xsl:value-of select="TitleBlock/Number"/></xsl:variable>
<xsl:variable name="Number select="TitleBlock/Number"/>
(and similarly for the other variable). You are constructing a temporary tree containing a copy of the selected data, which is a very expensive operation, when you only need a reference to the existing data. The Saxon optimizer does its best to eliminate the unnecessary work you have asked for, but it can't always achieve this.
Both of these are very common XSLT programming mistakes.

From: Roy Stafford []
Sent: 26 February 2009 19:20
Subject: [saxon] Saxon9 namespace issue



I am using an XML file that is generated for me that cannot be modified. I am using XSLT to transform some of the data into a tab delimited format for consumption by an external system.


My problem is that there is a namespace declaration (xmlns="") within the original XML file that seems to prevent Saxon9 from processing it properly. If this xmlns is removed, then it is processed correctly.


Results of run #1 with the original agile.xml file:

>java -jar saxon9.jar -s: agile.xml -xsl: test.xsl




Results of run #2 with the namespace declaration xmlns="” removed from the original XML file. No other changes were made:

>java -jar saxon9.jar -s: agile_noxmlns.xml -xsl:test.xsl


P00003  Test 3



I have attached both XML files and the XSL file.


I appreciate any insight on how to get the output in run #2 without modifying the original XML file or the namespace contents, both of which I do not have any control.