Reputation: 1083
I have a XML properties file in diffent path and it is like
<MyValues>
<MyValue1>test</MyValue1>
</MyValues>
I would like to read MyValue1 in xslt,where i'm doing conversion for different XML,which is in different path. My xsl is like
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:variable name="GetMyValue"
select="${MyValue1}"/>
</xsl:stylesheet>
how can i read MyValue1 from xml.
Upvotes: 0
Views: 386
Reputation: 167506
If you want to read in a secondary input file, then, given XSLT 2.0, you have the choice between the doc
function and the document
function. For a single file, doc
suffices, so you can declare a global variable or parameter with e.g. <xsl:variable name="input2" select="doc('dir/subdir/properties.xml')"/>
and then use that with e.g. <xsl:variable name="GetMyValue" select="$input2/MyValues/MyValue1"/>
.
Upvotes: 1