|
Subject: [xsl] How to handle dynamic XPath From: fred@xxxxxxxxxxxxx Date: Sun, 12 Apr 2009 21:07:29 +0200 |
I am using XSLT to walk through an XML Schema to construct an Xforms (output) instance. In parallel I am scanning an (input) instance (of a document defined by the schema) to include default values in the form.
Scanning of the input instance is done by means of a variable that keeps track of the path. The variable is updated (renewed) each time a template is (recursively) called with the variable as parameter:
<xsl:with-param name="instance.path" select="concat($instance.path,'/',$element.prefix,':',@name)" />
The template calls another template that writes the output instance. In that template I try to look up the default value in the input instance (an external document).
<xsl:value-of select="document('file:/C:/dir/order.xml')/$instance.path" />
writes a path string to the output instance instead of the value of
the element, such as:
/rsm:PurchaseOrder/rsm:Identifier, so does copy-of select.<xsl:value-of select="document('file:/C:/dir/order.xml')//rsm:DeliveryDate"
/>
writes correctly the content of the delivery date, but
<xsl:value-of select="document('file:/C:/dir/order.xml')//$deldate" />
(where $deldate contains the string "rsm:DeliveryDate") writes nothing.Concluding the problem is node-format vs text format, I tried the
saxon evaluate
function, but:
<xsl:copy-of
select="saxon:evaluate(document('file:/C:/dir/order.xml')/$instance.path)"
/>
writes nothing, neither does value-of.| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] How to integrate XSLT tag, G. Ken Holman | Thread | [xsl] Re : [xsl] How to handle dyna, Florent Georges |
| Re: [xsl] How to integrate XSLT tag, G. Ken Holman | Date | [xsl] Re : [xsl] How to handle dyna, Florent Georges |
| Month |