Subject: Re: Temporary tree elements and namespaces
From: "João Cruz Morais" <spiderfish@xxxxxxxxx>
Date: Thu, 14 Feb 2008 01:51:59 +0000
|
Typo. Where it's a and b should read tax and value.
Joco
On Feb 14, 2008 12:46 AM, Joco Cruz Morais <spiderfish@xxxxxxxxx> wrote:
> Thanks for your reply Sam.
> Just to clear things up, I'm converting an XML document (not binded to
> any namespace) to an Excel XML document.
>
> Meanwhile, I've done a little more research and testing and found out
> that fortunately my problem (and confusion) is way more generic than I
> thought. So let's step back for a minute and forget my original post
> for a second and exemplify again my problem.
>
> == XML document ==
>
> <?xml version="1.0"?>
> <values>
> <value>0.123</value>
> <value>0.234</value>
> </values>
>
> == Stylesheet ==
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns="required-excel-stylesheet">
> <xsl:variable name="taxes" as="item()*">
> <xsl:for-each select="//value">
> <xsl:element name="tax">
> <xsl:element name="value">
> <xsl:value-of select="format-number(.,'#.00')"/>
> </xsl:element>
> </xsl:element>
> </xsl:for-each>
> </xsl:variable>
> <xsl:template match="/">
> <xsl:value-of select="format-number(sum($taxes/value),'#.00')"/>
> </xsl:template>
> </xsl:stylesheet>
>
> The output of this transformation is 0.00. If I take out the default
> namespace from the stylesheet the output is now 0.35 which is a little
> puzzling.
>
> My guess is that both a and b are "binded" to a void namespace and
> when I place a default namespace in a surrounding scope I lose access
> to the other one, also losing access to a and b, is that right? If
> so, the only way to fix this is by creating some other namespace and
> bind it to both elements?
>
> I bet this question has been raised tons of times so sorry for having
> to take you through this again. :|
>
> Thanks again,
> Joco
>
--
Joco Cruz Morais
|