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

Re: sorting on data referenced with document()??

Subject: Re: sorting on data referenced with document()??
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 18 Sep 2002 09:09:57 +0200
exsl.node set.xsl
Hello Will,

I can only suggest to use Dimitre's solution, which doesn't need extension functions. If you have problems with it you can ask the list or Dimitre.

When you want to know how to use extension functions, you can have a look at http://xml.apache.org/xalan-j/extensionslib.html#ex-nodeset. It's the nodeset() function of Xalan, which works in the same way like the EXSLT function, but of course you are more processor dependent then. Replacing the Xalan namespace with the EXSLT namespace and replacing xalan:nodeset() with exslt:node-set() should work then. The namespace for EXSLT node-set() is xmlns:exslt="http://exslt.org/common" as you can see on http://www.exslt.org/exsl/functions/node-set/index.html. Xalan 2.4 supports EXSLT, so you don't need to download anything from www.exslt.org.

The problem with your code below:

You have declared xmlns:common="http://exslt.org/common", but you are using <xsl:for-each select="exsl:node-set($persons)/person">. You have to change either xmlns:common oder exsl:node-set() in the code. Both should use the same namespace-prefix. Furthermore you can add a extension-element-prefixes="exslt" (or exsl or common, the prefix you use) to the <xsl:stylesheet> to avoid the namepsace declaration on the output. I think http://www.exslt.org/howto.html can be really helpful.

But for your problem you should really use Dimitre's perfect solution.

Regards,

Joerg

Carter, Will wrote:
hmm...

I figured that I would first try the extension function route, but I can't quite figure out how to get it working. Excuse my ignorance, I am a xslt beginner and I have never added a.

anyway, I tried to first download the function itself:
http://www.exslt.org/exsl/functions/node-set/exsl.node-set.zip

but inside the zip, exsl.node-set.xsl isn't present.????

the only way I could get exsl.node-set.xsl in any manner is to download the all modules zip. http://www.exslt.org/all-exslt.zip
exsl.node-set.1.xsl and exsl.node-set.2.xsl are in that zip, so I am guessing that those are what I need.
I put these 2 xsl files in the same folder as my two.xsl


so I try to modify my stylesheet:
------------------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:common="http://exslt.org/common" xmlns="http://www.w3.org/tr/REC-html40" version="1.0">
<xsl:import href="exsl.node-set.1.xsl" />
<xsl:import href="exsl.node-set.2.xsl" />
------------------------------------------------------

I add the variable as instructed (i hope this is right):
------------------------------------------------------
<xsl:variable name="persons">
   <xsl:for-each select="people/person">
     <xsl:copy>
       <xsl:copy-of select="@*"/>
       <xsl:copy-of select="*"/>
       <xsl:variable name="ownerName" select="@name"/>
       <xsl:for-each select="document('xml2.xml')">
         <xsl:copy-of select="key('turtleByOwner', $ownerName)"/>
       </xsl:for-each>
     </xsl:copy>
   </xsl:for-each>
</xsl:variable>
------------------------------------------------------

and I change the for each in the stylesheet to:
------------------------------------------------------
<xsl:for-each select="exsl:node-set($persons)/person">
------------------------------------------------------

I try to transform with xalan at my command line and I get:
------------------------------------------------------
java org.apache.xalan.xslt.Process -in xml1.xml -xsl two.xsl -out 2.html
file:///C:/xsl/two.xsl; Line 25; Column 57; XSLT Error (javax.xml.transform.Tran
sformerConfigurationException): javax.xml.transform.TransformerException: javax.
xml.transform.TransformerException: Prefix must resolve to a namespace: exslt
------------------------------------------------------

what am I doing wrong?
will


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.