[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Temporary tree elements and namespaces

Subject: Re: Temporary tree elements and namespaces
From: "João Cruz Morais" <spiderfish@xxxxxxxxx>
Date: Thu, 14 Feb 2008 00:46:24 +0000
Re:  Temporary tree elements and namespaces
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.