Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > node-set working for msxml3 , msxml4 , saxon 8.1

Reply
Thread Tools

node-set working for msxml3 , msxml4 , saxon 8.1

 
 
Rolf Kemper
Guest
Posts: n/a
 
      04-12-2005
Hi All,

ned help on the example below. It works fine for msxml3/4 but has
problems with saxon. Saxon complains "can not find matching function
..... "

My target is to write style sheets usable for msxml3 , msxml4 , saxon
..
Is there a general solution ?

Any help is highly welcome.

Rolf

<xsl:stylesheet version="2.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-comslt">
<xslutput method="xml" encoding="UTF-8" />

<xsl:variable name="gMyNodes">
<MyNodes>
<a/>
<b/>
</MyNodes>
</xsl:variable>

<xsl:template match="/">
<xsl:variable name="vMyNodeSet">
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:copy-of select="msxsl:node-set($gMyNodes)"/>
</xsl:when>
<xsltherwise>
<xsl:copy-of select="$gMyNodes"/>
</xsltherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$vMyNodeSet"/>
</xsl:template>

</xsl:stylesheet>
 
Reply With Quote
 
 
 
 
David Carlisle
Guest
Posts: n/a
 
      04-12-2005

<xsl:when test="function-available('msxsl:node-set')">
<xsl:copy-of select="msxsl:node-set($gMyNodes)"/>
</xsl:when>

saxon 6's node set function is in the saxon namespace
xmlns:saxon="http://icl.com/saxon"
so you could add a when clause for that that uses saxon:node-set

Perhaps your example is just over simplified for posting but the above
code doesn't need node-set extension at all, if you are just copying to
the result you could use
<xsl:copy-of select="$gMyNodes"/>
with identical results.


David
 
Reply With Quote
 
 
 
 
Rolf Kemper
Guest
Posts: n/a
 
      04-13-2005
David Carlisle <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> <xsl:when test="function-available('msxsl:node-set')">
> <xsl:copy-of select="msxsl:node-set($gMyNodes)"/>
> </xsl:when>
>
> saxon 6's node set function is in the saxon namespace
> xmlns:saxon="http://icl.com/saxon"
> so you could add a when clause for that that uses saxon:node-set
>
> Perhaps your example is just over simplified for posting but the above
> code doesn't need node-set extension at all, if you are just copying to
> the result you could use
> <xsl:copy-of select="$gMyNodes"/>
> with identical results.
>
>
> David


Dear David ,

Thank you for yopur feedback. Yes , I have oversimplified a bit. But
my real intention is to process the result of a temporary node set
further on by xslt.

I have tried your proposal, may be I made it wrong. It still complains
with saxon8.1.1. I have marked the error lines by comment. Please find
the modified xslt and the result for saxon below.
Do I really need the node-set function for saxon ?
I was thinking for xslt 2.0 I do not need a specific function to get
access to a temporary node set.

Thanks a lot

Rolf

<xsl:stylesheet version="2.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-comslt"
xmlns:saxon="http://icl.com/saxon"
>

<xslutput method="xml" encoding="UTF-8" />

<xsl:variable name="gMyNodes">
<MyNodes>
<a/>
<b/>
</MyNodes>
</xsl:variable>

<xsl:template match="/">
<NodeTest>
<xsl:variable name="vMyNodeSet">
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<msxml>
<xsl:copy-of select="msxsl:node-set($gMyNodes)"/><!-- saxon
error -->
</msxml>
</xsl:when>
<xsl:when test="function-available('saxon:node-set')">
<saxon>
<xsl:copy-of select="saxon:node-set($gMyNodes)"/><!-- saxon
error -->
</saxon>
</xsl:when>
<xsltherwise>
<ERROR>No node set function available, or missing
processor</ERROR>
</xsltherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$vMyNodeSet"/>
</NodeTest>
</xsl:template>

</xsl:stylesheet>
 
Reply With Quote
 
David Carlisle
Guest
Posts: n/a
 
      04-13-2005


I have tried your proposal, may be I made it wrong. It still complains
with saxon8.1.1

That's why I said saxon 6. I just noticed that the subject line does
explictly say saxon 8 but I missed that on first reading


To be honest you probably shouldn't be using saxon 8.1: saxon 8 is
tracking the XSLT 2 drafts so is something of a moving target, It's
pretty stable but I think it's best to keep up to date (8.4 is current)
lest you find you are relying on some feature that got changed in the
final spec.

There is an extension namespace in saxon 8 (check the docs) but
it's not the same one as for saxon6. But in that case you are correct
that it shouldn't be needed at all. as you can use XSLT2 features (even
though presumably your stylesheet is flagged as version="1.0" so you
will be in backward compatibility mode.

David
 
Reply With Quote
 
David Carlisle
Guest
Posts: n/a
 
      04-13-2005


I tried your stylesheet (running on itself) with saxon 8.4, it falls
foul of compile time checking. XSLt2 allows the system to report
certain errors even in code that will never be executed.
(Don't blame me
this severely compromises the use of function-available in an xsl:choose
as a guard for conditional code as the compiler barfs on the branches
that will not be executed. A compile time xsl:use-when facility has been
added to try to restore some usability, I have added this to your code
below and Ithink it should work now in msxml saxon6 and saxon8 (although
I only ran it with saxon 8.4)

David



<xsl:stylesheet version="2.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-comslt"
xmlns:saxon="http://icl.com/saxon"
>

<xslutput method="xml" encoding="UTF-8" />

<xsl:variable name="gMyNodes">
<MyNodes>
<a/>
<b/>
</MyNodes>
</xsl:variable>

<xsl:template match="/">
<NodeTest>
<xsl:variable name="vMyNodeSet">
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<msxml>
<xsl:copy-of use-when="function-available('msxsl:node-set')" select="msxsl:node-set($gMyNodes)"/><!-- saxon
error -->
</msxml>
</xsl:when>
<xsl:when test="function-available('saxon:node-set')">
<saxon>
<xsl:copy-of use-when="function-available('saxon:node-set')" select="saxon:node-set($gMyNodes)"/><!-- saxon
error -->
</saxon>
</xsl:when>
<xsl:when test="system-property('xsl:version')='2.0'">
<saxon8>
<xsl:sequence select="$gMyNodes"/>
</saxon8>
</xsl:when>
<xsltherwise>
<ERROR>No node set function available, or missing
processor</ERROR>
</xsltherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$vMyNodeSet"/>
</NodeTest>
</xsl:template>

</xsl:stylesheet>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXML4 and selectSingleNode Marja Ribbers-de Vroed ASP General 1 02-13-2006 01:02 PM
MSXML4 - parsing XML Leaves with multiple parameters milesd XML 0 06-14-2005 11:38 AM
why SOM of msxml4 can't load this schema? tgtt XML 2 01-28-2004 11:47 PM
PBM: MSXML4 typelib constants not recognized in server-side script Vince C. ASP General 12 01-15-2004 06:48 PM
Access Error with msxml4.dll Jason Burr ASP General 2 01-12-2004 08:02 PM



Advertisments