[xsl] Xpath as variable, then processing it

Subject: [xsl] Xpath as variable, then processing it
From: <michella@xxxxxxx>
Date: Fri, 31 Dec 2004 12:38:32 +0100
Hi all,

I have a little question :

I have a small XML Data containing in one of its field an Xpath (as
text) which should be used in an XSL-T for querying data in another XML
using this XPath. The following XSL handles it as a variable.

<Classes>
	<Class>
		<Architecture name="Application" abr="AA">
			<xsl_File name="App_Apt_Apx_Applications"

file="App_Apt_Apx_Applications.xsl"

XPath="/Classes/Class/SADefinition[starts-with(@SAObjName,'app_') or
starts-with(@SAObjName,'apx_') or starts-with(@SAObjName,'apt_')]"/>
(...)

Then, the XSL file looks as follow :

<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:variable name="mainXML_node"
select="document('../XML/PM-EA-AA_IA_PA_TA.xml')"/>     (The main XML)
	<xsl:output method="html" version="1.0" encoding="UTF-16"
indent="yes"/>
	<xsl:template match="/">
		<xsl:result-document
href="../TCL/Temp/TCL_Data_Config.tmp">
			<xsl:value-of disable-output-escaping="yes"
select="'{'"/>
			<xsl:for-each-group
select="/Classes/Class/Architecture" group-by="@name">
				<xsl:sort select="@name"/>
				<xsl:value-of
disable-output-escaping="yes" select="concat('{',@name,' ')"/>
				<xsl:for-each-group select="xsl_File"
group-by="@name">
					<xsl:sort select="@name"/>
					<xsl:variable name="path"
select="@XPath"/>
					<xsl:value-of
disable-output-escaping="yes" select="concat('{',@name,' ')"/>
					<xsl:for-each
select="$mainXML_node">			(Here is the problem)
						<xsl:for-each-group
select="$path" group-by="@SAObjName">
							<xsl:sort
select="@SAObjName"/>
(...)



I hope the upon the text is correctly indented by your mail browser.

Unfortunately, it won't work. Have anyone got an idea on how to solve my
problem?

Best regards

Lawrence

Current Thread