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

Re: dynamic sorting

Subject: Re: dynamic sorting
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 5 Feb 2004 17:24:08 GMT
dynamic list sort
  both expressions should give the same
  result?

  1. select="count(someNode)"
  2. select="count(*[name() = someNode])"

No the first one is similar to

2. select="count(*[name() = 'someNode'])"

as you have it, without the quotes, you are selecting elements whose name
is equal to the string content of their someNode child, ie things like
<abc>auk iu <someNode>abc</someNode> jhg </abc>
would be selected as name() and someNode both have string value 'abc'.

> What do you mean with "namespace-safe"? 
If you use a document with namespaces (eg a stylesheet) then selecting
count(xsl:variable)
will tell you how many variable elements in the xsl namespace are there
even if the stylesheet uses a different prefix or no prefix for xsl
elements.

count(*[name()='xsl:variable']) might tell you how many xsl:variable
elements are there, but if the user used a different prefix they
probably won't be counted and even if the user used teh prefix "xsl"
they may not be counted as the XML parser is allowed to ignore the
prefixes used and substitite its own normalised prefix (although most do
not do this).

David




-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.