Reputation: 832
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..??
Upvotes: 2
Views: 3172
Reputation: 10198
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>
Upvotes: 9
Reputation: 5348
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.
Upvotes: 0
Reputation: 2228
Merge the two files under a new parent tag and send the whole thing through the XSLT.
Upvotes: 2