Subject: Re: Newbie to XSLT From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 9 Feb 2000 14:17:59 GMT |
>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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Newbie to XSLT, Pady Srinivasan | Thread | Re: Newbie to XSLT, Steve Tinney |
Re: XML hierarchy, John E. Simpson | Date | Re: Newbie to XSLT, Steve Tinney |
Month |