including data from a separate xml-file
Posted: Thu Dec 25, 2008 7:31 pm
A external application is sending error-xml-files as respond.xml, if an error occures. I try to transform these Messages into a readeble text. But the respond.xml has only error-codes. But I would like to see the real error-message, wich I can find in errors.xml
Is it possible to combine my xslt to errors.xml?
How could I include that errors.mxl to my xslt-File rtest.xsl?
Thank you for your help!
Joseph
A respond.xml looks abot like this:
The errors.xml is like this:
And my xslt-File looks this way:
Is it possible to combine my xslt to errors.xml?
How could I include that errors.mxl to my xslt-File rtest.xsl?
Thank you for your help!
Joseph
A respond.xml looks abot like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<invoice:response xmlns:invoice="abc">
<invoice:invoice invoice_id="9549">
</invoice:invoice>
<invoice:status>
<invoice:rejected>
<invoice:error error="101"/>
<invoice:error error="103"/>
</invoice:rejected>
</invoice:status>
</invoice:response>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error_id>101</error_id>
<message>invalid address</message>
<error_id>102</error_id>
<message>invalid amount</message>
<error_id>103</error_id>
<message>wrong currency</message>
</errors>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="invoice:status" xmlns:invoice="abc">
<xsl:if test="invoice:rejected"> Responsetyp: Rejected
<xsl:for-each
select="invoice:rejected/invoice:error"> Error: <xsl:value-of select="@error"/>
<!-- Here should be the error-message from errors.xml-->
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>