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

Re: Newbie to XSLT

Subject: Re: Newbie to XSLT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 9 Feb 2000 14:17:59 GMT
size xsl

>Basically, how do we store the "Cube 47" value in a variable, then use
>it to go back through the document and look for the size for "Cube 47"
>??? ) 

putting <x> ... </x> around your posted example to make it well formed:

bash-2.01$ xt size.xml size.xsl 
<?xml version="1.0" encoding="utf-8"?>
John has size 26 ft.
 bash-2.01$ 

You probably don't need a variable, I used on below to make 
the expression a bit easier to read.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                >

<xsl:output method="xml" indent="yes"/>

<xsl:template match="x">
 <xsl:for-each select="instance[@name='pc']">
  <xsl:value-of select="value"/> has size <xsl:apply-templates select="."/>.
 </xsl:for-each>
</xsl:template>

<xsl:template match="instance[@name='pc']">
  <xsl:variable name="x" select="../instance[@type='Association']
         [reference[@antecedent='pc']/value[.=current()/value]]
         /reference[@dependent='location']/value"/>
  <xsl:value-of select="../instance[@name='location'][value=$x]/size"/>
</xsl:template>

</xsl:stylesheet>


 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.