xsl-list
[Top] [All Lists]

Re: alternative to namespace exmaple

2005-01-13 09:09:31
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[(_at_)whose='us']/value) - sum(//item[(_at_)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(_at_)mulberrytech(_dot_)com
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
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>