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

RE: embed XML island in stylesheet?

Subject: RE: embed XML island in stylesheet?
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Thu, 1 Nov 2001 04:06:09 -0000
embed xml stylesheet
Dan,
Since you prefer to talk to DC direct and give me no credit for my maybe
slightly flippant (absolutely correct) answer I won't give you the
obvious (and easiest) solution. You'll have to wait another 6 hours for
the great oracle. 
Key huh! You are at the end of a long dark passage. To the left is the
current stylesheet. To the right is a small piece of stylesheet. A
little xpath is singing.
Take Rod!
Nothing happens.
Plugh!
Nothing happens.
Xyzzy
Nothing happens.
There is a cage here!

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Dan Diebolt
> Sent: 01 November 2001 03:17
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  embed XML island in stylesheet?
> 
> 
> David - thanks for your help. 
> 
> I am trying to add a fragment of XML to my stylesheet to 
> avoid loading a ancillary XML document that would conatin 
> some type of lookup information. For simplicity lets just say 
> that during the course of transforming my main XML document I 
> need some lookup capability which for the example can simply be this:
> 
>    1 -> one
>    2 -> two
>    3 -> three
>    4 -> four
> 
> Your last mail alluded to having two choices a get a handle 
> on the fragment of lookup XML:
> 
> 1) stuff the XML lookup fragment into <LookUp:data> and access it with
>    the following XPath:
> 
>    select="document('')/xsl:stylesheet/LookUp:data"/
> 
> 
> 2) stuff the lookup fragment into the body of a variable definiton and
>    access it with:
> 
>    select="$var" 
> 
> I know how to do the key definition for the Lookup. I would 
> simply like to work out the details of addressing the XML 
> fragment by each of the two methods. Here is my attempt to 
> put both techniques to work in the same stylesheet:
> 
> <?xml version="1.0"?>
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                  xmlns:LookUp="Something"
>                  version="1.0">
> 
> <LookUp:data>               
>    <x>1</x><y>one</y>
>    <x>2</x><y>two</y>
>    <x>3</x><y>three</y>
>    <x>4</x><y>four</y>
> </LookUp:data>
> 
> <xsl:variable name="var2">
>    <x>1</x><y>one</y>
>    <x>2</x><y>two</y>
>    <x>3</x><y>three</y>
>    <x>4</x><y>four</y> 
> </xsl:variable>
> 
> <xsl:template match="/">
>  <xsl:variable name="var1" 
>   select="document('')/xsl:stylesheet/LookUp:data"/>
>  <xsl:for-each select="$var1/x">
>   (<xsl:value-of select="."/>,
>   <xsl:value-of select="following-sibling::y[1]"/>)<br/>
>  </xsl:for-each>
>  <hr/>
>  <xsl:value-of select="$var2"/>
>  <hr/>
>  <xsl:for-each select="$var2/x">
>   (<xsl:value-of select="."/>,
>   <xsl:value-of select="following-sibling::y[1]"/>)<br/>
>  </xsl:for-each>   
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> Here is the result I obtain:
> 
> (1,one)
> (2,two)
> (3,three)
> (4,four)
> -----------------
> 1one2two3three4four
> -----------------
> The XML page cannot be displayed 
> Cannot view XML input using XSL style sheet. Please correct 
> the error and then click the Refresh button, or try again later. 
> Reference to variable or parameter 'var2' must evaluate to a 
> node list.
> 
> What is wrong with the second technique? I would like to 
> compare these two techniques on a common bases so the code is 
> somewhat symmetrical. 
> 
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals. 
> http://personals.yahoo.com
> 
>  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.