473,378 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

xsl:number when no matching nodes

In my XSLT stylesheet, if I call

<xsl:number level="any" count="sdfsjdfjsdfksndfn"/>

where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would
expect it to return 0. However, on the XSLT processor I'm using (.net
framework 1.1) it seems to return an empty string (or possibly an empty node
set)

I had a look here: http://www.w3.org/TR/xslt and I can't find any
specification of what should happen if xsl:number can't find any nodes to
number. Is it safe to rely on the "empty string" behaviour?

Andy
Jul 20 '05 #1
3 1369


Andy Fish wrote:
In my XSLT stylesheet, if I call

<xsl:number level="any" count="sdfsjdfjsdfksndfn"/>

where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would
expect it to return 0. However, on the XSLT processor I'm using (.net
framework 1.1) it seems to return an empty string (or possibly an empty node
set)

I had a look here: http://www.w3.org/TR/xslt and I can't find any
specification of what should happen if xsl:number can't find any nodes to
number. Is it safe to rely on the "empty string" behaviour?


I have tried with MSXML, with Saxon, and with Xalan, the latter produces
a 0, the other ones an empty string.
So that seems indeed to be an area where processor behaviour differs.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:42**********************@newsread2.arcor-online.net...


Andy Fish wrote:
In my XSLT stylesheet, if I call

<xsl:number level="any" count="sdfsjdfjsdfksndfn"/>

where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would
expect it to return 0. However, on the XSLT processor I'm using (.net
framework 1.1) it seems to return an empty string (or possibly an empty
node set)

I had a look here: http://www.w3.org/TR/xslt and I can't find any
specification of what should happen if xsl:number can't find any nodes to
number. Is it safe to rely on the "empty string" behaviour?
I have tried with MSXML, with Saxon, and with Xalan, the latter produces a
0, the other ones an empty string.
So that seems indeed to be an area where processor behaviour differs.


Thanks Martin,

I would have thought 0 is more logical. Still, putting a test for '' and
turning it into a 0 is compatible with them all so it's no big deal.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
So that seems indeed to be an area where processor behaviour differs.


Note that there are some clarifications/errata in the area of xsl:number
on no matching nodes

http://www.w3.org/1999/11/REC-xslt-19991116-errata/#E23

so some processors may have been fixed before this clarification was
made...

David
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: johkar | last post by:
My XML and XSL is below. Also below is a textual representation of what I want to get out of the XML with XSL. For each Extension node in XML, I am only concerned with those nodes with...
3
by: Rupa | last post by:
Hi, I'm trying to write an xslt to convert an email in xml format to a new xml format. <descr> <xsl:choose> <xsl:value-of select="body"> </xsl:value-of select> <xsl:when test=" <xsl:value-of...
2
by: gimme_this_gimme_that | last post by:
What xpath expression would return the category-item having uid sps002 ? <category-list> <category> <uid>GRIDS_MAIN_CATEGORY_UID</uid> <uid-type>Categories</uid-type> <category-item-list>...
3
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number>...
5
by: Guiding5 | last post by:
Hi group! Basic question about counting specific nodes in the range, here the example: XSL: <xsl:stylesheet version="1.0"> <xsl:template match="/">
0
by: Jean-François Michaud | last post by:
Hello all, I'm looking into putting together an alternate page numbering on a figure element that we have to deal with. Each figure has its own page sequence through the use of an...
2
by: Doug | last post by:
I've been researching the answer to this without luck. I need to use <xsl:when and use an OR condition. Either it can't be done or I just haven't figured out the syntax. <xsl:when test="xyz =...
14
by: ajfish | last post by:
Hi, I am trying to allocate a unique ID to every instance of tag 'foo' in a large XML document. currently I'm doing this: <xsl:variable name="UniqueId"> <xsl:number count="foo" level="any"/>...
2
by: Kniffel | last post by:
Hi Is there a possibility to make an <xsl:whenon more than one Selection? Not that way: <xsl:choose> <xsl:when a=test> Do this <xsl:when a=test2>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.