Re: Temporary tree elements and namespaces
to specify a default namespace in XSLT 2, you use the "xpath-default-namespace" attribute. However, I don't fully understand your question:
After some wasted hours I've figured out that the problem is the default namespace that Excel *requires* to be present.
Requires to be present in the output XML file? i.e you indicate you are "converting" an XML document to an Excel XML file; is your XSLT intending to do this conversion, or have you done a conversion manually and your XSLT below is intended to transform the converted (Excel) XML file?
The XSLT you provided does not output XML, but text; so I'm thinking that the "real" XML source you are having to use has some namespace issues making your code not work. If so, perhaps you could provide an input example where such namespaces are used?
=== XML FILE ===
In your "final version", are the values and value elements in some particular namespace that we don't see in this example?
I'm going to assume that is the case. For the following XML file:
<?xml version="1.0" encoding="ISO-8859-1"?> <values xmlns="some.Excel.default.namespace"> <value>0.123</value> <value>0.234</value> </values>
Your original XSLT file will work with just a few slight mods:
-- change your xsl:stylesheet line to something like this:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="some.Excel.default.namespace">
-- then add foo: in a couple places:
<xsl:template match="/foo:values"> <-- here
<xsl:for-each select="foo:value"> <-- and here
Does that 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