xsl-list
[Top] [All Lists]

Re: [xsl] Getting a specific element count from a generic match

2006-04-11 05:52:27
On 4/10/06, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:


Not sure if it helps or not, but here is the vb.net code I use:

OK, thanks, you didn't mention it was on .NET or vb.net in particular. Looks
as if I might need to do some more testing in that environment: nearly all
my .NET testing was from C#.

If you hit other such problems, please do raise them on the saxon-help list
or forum. The .NET product is quite new so usability feedback is very much
appreciated.

Isn't this purely a fault with the stylesheet, rather than being
specific to saxon.net?

Look at the stylesheet:

1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="2.0"
3 x mlns:xsl="http://www.w3.org/1999/XSL/Transform";>
4
5 <xsl:variable name="namelist"
select="distinct-values(//*/node-name())"/>
6
7  <xsl:variable name="root" select="/"/>
8
9 <xsl:template match="/">
10   <xsl:for-each select="$namelist">
11     <xsl:variable name="thisname" select="name()"/>
12     <name value="{$thisname}"
count="{count($root//*[name() = $thisname])}"/>
13   </xsl:for-each>
14 </xsl:template>
15
16 </xsl:stylesheet>

Here $namelist contains a list of items of xdt:anyAtomicType yet it's
trying to be used as a list of nodes (when name() is called on each
item in the sequence).  Saxon is probably staticly aware of this which
is why its not compiling the stylesheet, whereas other processors wont
reveal the error until runtime....

--~------------------------------------------------------------------
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>
--~--