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

Re: Implementing XPointer Resolution With saxon:evalua

Subject: Re: Implementing XPointer Resolution With saxon:evaluate()
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Aug 2002 16:26:03 +0100
Re:  Implementing XPointer Resolution With saxon:evalua
Hi Eliot,

I'm a bit worried about this part of your xindrf:resolve-xpointer()
function:

>       <xsl:variable name="direct-result-set"
> select="saxon:evaluate($xpointer)"/>
>       <xsl:for-each select="$direct-result-set">
>         <xsl:choose>
>           <xsl:when test="self::xindr:indirector and
> ($indirector-treatment-str != 'as-resource')" >
>             <func:result select="xindrf:resolve-indirector(.)"/>
>           </xsl:when>
>           <xsl:otherwise>
>             <func:result select="."/>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:for-each>

One of the rules about EXSLT function definitions is that the
processor must only encounter one func:result instruction when
evaluating the function body. This is to preserve the usual
side-effect-free nature of XSLT (and is why func:result is called
func:result rather than func:return).

It looks to me here as if it could be possible for $direct-result-set
to hold any number of nodes, which would mean that you would get
multiple func:result instructions, which would be an error. To prevent
that, you should use:

  <xsl:for-each select="$direct-result-set[1]">
    ...
  </xsl:for-each>

or (if you want to be able to handle multiple points), rejig the code
so that you use recursion to collect together all the nodes that you
want to return from the function.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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-2011 All Rights Reserved.