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

RE: variable holding a xml document created by xslt

Subject: RE: variable holding a xml document created by xslt
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Sun, 11 Apr 2004 03:09:25 -0600
david peterson sun
Hey Robert,

In fact I believe I remember our conversation from last year.  Im glad
to see that the lookup table has been of some help to you.  You are
correct in how you would access the value of the variable. But in this
particular case you are going to need to use the node-set function of
msxsl to give you what you need.  To do this you will need to declare
the msxsl namespace as a part of your stylesheet decleration like so...

<xsl:stylesheet version = "1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
   exclude-result-prefixes = "msxsl">

Next, you will need to create a variable that contains the dynamic
values you want.

<xsl:variable name="getLookupValuesforRect">
	<xsl:element name="label">
		<xsl:attribute name="x1">100</xsl:attribute>
   		<xsl:attribute name="x2">110</xsl:attribute>
	</xsl:element>
</xsl:variable>

Finally, create another variable that you will call the node-set
function from within the select attribute.  You will then you the method
you describe to access its content.

<xsl:variable name="get-rect"
select="msxsl:node-set($getLookupValuesforRect)/>

If the size of the xml tree was reasonable you could just use one
variable like so:

<xsl:variable name="get-rect" select="msxsl:node-set('<label x1="100"
x2="110">')/>

But its easy to see how this method could become unmanageable fairly
quickly...

Either way using "$get-rect/label/@x1" will get you the value of
attribute x1.

Hope this helps!

Best regards,

<M:D/>

-----Original Message-----
From: Robert Van Gemert [mailto:rcvangemert@xxxxxxxxxxxxxxxx] 
Sent: Sunday, April 11, 2004 2:47 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  variable holding a xml document created by xslt

Thanks David,

Confused? yep!

You showed me the lookup idea last year and I use it now for constants
but
in this case the lookup list will change depending on what lables are in
view, so the list needs to be created dynamically.

I am using msxml4,  I think you are suggesting that if I create a
template
that returns a xml fragment

eg.

<template name="get-rect"
 <xsl:value-of select>
   <lable>
    <xsl:attribute name="x1">100</xsl:attribute>
    <xsl:attribute name="x2">110</xsl:attribute>
  <lable>
 </xsl:value-of select>
</template>

I can access this fragment using

<xsl:variable name="lable-rect">
 <xsl:call-template name="get-rect"/>
<xsl:variable>

$lable-rect/@x1

-RVG

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.