Hi can i do this in a xslt , and if yes then how..? I have one xml file which contains one element called 'reasonCode' , this reason code is mapped to different 'reasonText' in another xml.What i hae to do is check the 'reasonCode' from first xml and select the corresponding 'reasonText' from second xml.Can i do this using XSLT...if yes then please give me brief idea how..??
+2
A:
Merge the two files under a new parent tag and send the whole thing through the XSLT.
Abraham Pinzur
2009-09-16 03:07:02
but both of my xml have different structure , wont it create a problem.I will use document(abc.xml) command in xslt to merge...
Vivek
2009-09-16 03:16:31
A:
I agree with Abraham's answer. I have written combineNavigableDocuments() methods in PHP, Java and C# to deal with this type of problem. You can also use the XSLT document function but this can lead to unexpected permissions problems in security-aware platforms like .NET.
rasx
2009-09-16 03:58:35
+6
A:
You can use the document()
function to access another XML document. For example:
<xsl:template match="reasonCode">
<xsl:variable name="code" select="."/>
<xsl:value-of select="document('another.xml')//reasonText[@code = $code]"/>
</xsl:template>
Jukka Matilainen
2009-09-16 05:19:07
You even can replace `'another.xml'` with a value of the source document like e.g. an attribute: `document(@href)`.
Boldewyn
2009-12-17 12:10:39