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

Re: alternative to namespace exmaple

Subject: Re: alternative to namespace exmaple
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 13 Jan 2005 11:09:31 -0500
namespace format number
Dmitri,

I think you are right in suspecting that this is over-engineered -- if that's what you're suspecting.

<us:item xmlns:us="www.uss.com">
<us:value>4000</us:value>
</us:item>

<them:item xmlns:them="www.them.com">
<them:value>1000</them:value>
</them:item>

Could more easily be


<item whose="us">
  <value>4000</value>
</item>
<item whose="them">
  <value>1000</value>
</item>

etc.

Then

<xsl:value-of select="format-number(sum(//us:value) - sum(//them:value),
'###,###,##0.00')" />

and


<xsl:value-of select="format-number(sum(//*[local-name() = 'value']),
'###,###,##0.00')" />

could be


<xsl:value-of select="format-number(sum(//item[@whose='us']/value) - sum(//item[@whose='them']/value),
$sum-format)" />


and

<xsl:value-of select="format-number(sum(//value), $sum-format)" />

(declaring $sum-format as '###,###,##0.00')

Without knowing more about it, I think the application of namespaces doesn't get you much here: it merely makes things messy and complicated. (I can't, however, say what impact this would have on performance, if any, without trying it.)

Things could be simplified even further if you don't actually need those <item> element wrappers (label the values themselves with their "owners").

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.