[xsl] Evaluating a variable as part of XPath Query

Subject: [xsl] Evaluating a variable as part of XPath Query
From: "Alan Flaherty" <alan@xxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Jan 2003 16:09:05 -0000
Hi List,

I'm trying to use xslt to generate a number of controls for a page on a
website but some of the controls will need "referenced" values which are
found in the source xml file itself, these referenced values will always
be found in the settings section of the xml definition file, how can I
generate an XPath expression like so:

propertyPage/settings/elementId/text() 

when 'elementId' is passed as the reference required from the xml file
to the xslt file, see below marked !!!Problem area!!! 

In the samples below the method is (trying to be) used to generate the
full src of an iframe, some of the values the iframe page requires are
in the xml definition file

Settings section of xml file:
<propertyPage title="" tabHeight="400" tabWidth="380">
	<settings>
		<elementType>product</elementType>
		<elementId>-1</elementId>
	</settings>

....

Definition for iframe control:
<control type="iframe" title="General" x="5" y="5" w="290" h="140">
	<attributes src="iframe/Image.aspx">
		<param type="val" name="ImageType" value="FabricColor"/>
		<param type="property" name="ElementId"
value="elementId"/>
	</attributes>
</control>


Xslt 
<xsl:variable name="src">
<xsl:value-of select="concat(attributes/@src,'?')" />
	<xsl:for-each select="attributes/param">
		<xsl:choose>
			<xsl:when test="string(@type)='property'">
				<xsl:value-of select="@name" />
				=


!!!! Problem Area, Looks like I misunderstood the meaning of
msxsl:node-set !!! 

<xsl:value-of select="//settings/msxsl:node-set(@value)/text()"/>



			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="@name"
/>=<xsl:value-of select="@value"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:if test="following-sibling::node()">
			<xsl:text><![CDATA[&]]></xsl:text>
		</xsl:if>
	</xsl:for-each>
</xsl:variable>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread