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

Re: document scope difficulty (Was: decode( source, ... )

Subject: Re: document scope difficulty (Was: decode( source, ... )
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Tue, 5 Oct 1999 00:26:23 -0700
xsl html decode
I get mon34 as the output using our Oracle XSLT
engine so I'm pretty sure the sum one is just a bug.

You could use a top-level:

 <xsl:stylesheet>
   <xsl:param name="monthlookup">defaultfile.xml</param>


and later use:

    document($monthlookup)//xyz

How you override the default values of top-level "stylesheet"
param's is implementation-specific...

________________________________________________________
Steve Muench, BC4J Development Team & XML Evangelist
http://technet.oracle.com/tech/java
http://technet.oracle.com/tech/xml
----- Original Message ----- 
From: Clark C. Evans <clark.evans@xxxxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Cc: James Clark <jjc@xxxxxxxxxx>
Sent: Monday, October 04, 1999 10:54 PM
Subject: document scope difficulty (Was: decode( source, ... )


| 
| Is there a way to specify the "primary" document
| in a <xsl:for-each select="" > construct?  
| 
| On Sun, 3 Oct 1999, James Clark wrote:
| > <xsl:value-of
| >   select="document('month.xml')
| >            /months/month[number(substring('19991003',5,2))]"/>
| 
| This was *sweet* ... now I'd like to take it one step further
| and drive report headers/footers using this technique.
| Unfortunately, the document() specifier works too well...
| it seems to be changing the entire scope of the construct.
| 
| Here is an example for illustration:
| 
| ----------------- stylesheet.xsl ------------------
| <xsl:stylesheet
|   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
|   xmlns="http://www.w3.org/TR/REC-html40"
|   result-ns="">
| <xsl:template match="/">
|    <html>
|   <xsl:for-each select="document('two.xml')//day-list" >
|      <xsl:value-of select="day" />
|      <xsl:value-of select="sum(//amount)" />
|    </xsl:for-each>
|   </html>
| </xsl:template>
| </xsl:stylesheet>
| ----------------- one.xml -------------------------
| <entry-list>
|   <entry>
|     <day>mon</day>
|     <amount>34</amount>
|   </entry>
| </entry-list>
| ----------------- two.xml -------------------------
| <root>
|   <day-list>
|     <day>mon</day>
|   </day-list>
|   <amount> 99 </amount>
| </root>
| ----------------- command line --------------------
| xt one.xml stylesheet.xsl
| ----------------- expected output -----------------
| mon 34
| ----------------- actual output -------------------
| mon 99
| ---------------------------------------------------
| 
| The sum(//amount), unfortunately, seems to be
| pointing at document two.xml, not document one.xml.
| 
| Any way to fix this "scope" problem? 
| 
| Of course, I could "sum(document('one.xml')//amount)", however:
| 
| a) I was not expecting document('two.xml') to change
|    the current root node; is this a bug?
| 
| b) You can't hard code the input file name beacuse
|    it will change; perhaps a param could be set automagically?
| 
| c) I found that document('') means the stylesheet...
|    so I was hoping for some other like trick!
| 
| Thank you!
| 
| Clark
| 
| 
|  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| 


 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.