Bypass XSLT Transformation if only specified values Exist - xslt

Good evening Experts. My requirement is as follows. I am transforming a target message based on materials that shouldn't be passed. If the target message contains certain materials these are to be removed from the target.
However we are to also check if the target message contains nothing but, (ONLY), these materials then the transformation should not remove these at all.
Currently the code below is to find and remove the materials in question. Please suggest how to ignore the transformation for this new requirement.
Im considering the choose->when->otherwise case.
Many thanks in advance.
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="#*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='407303']"/>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='243']"/>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='262']"/>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='265']"/>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='5624']"/>
<xsl:template match="E1EDP01[E1EDP19/IDTNR ='145416']"/>
Sincere apologies :- Sample input has only 2 line items but should still create this output. You can copy the E1EDP01 bit multiple time to cater for the other IDTNR values.
Thank you Jim.
<?xml version="1.0" encoding="UTF-8"?>
<ORDERS05><IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>ORDERS05</IDOCTYP>
<MESTYP>ORDERS</MESTYP>
<SNDPOR>SNDPOR</SNDPOR>
<SNDPRT>KU</SNDPRT>
<SNDPFC>AG</SNDPFC>
<SNDPRN>BWH</SNDPRN>
<RCVPOR>RCVPOR</RCVPOR>
<RCVPFC>LS</RCVPFC>
<RCVPRN>RCVPRN</RCVPRN>
</EDI_DC40>
<E1EDK01 SEGMENT="1">
<BSART>UB</BSART>
<BELNR>4505345253</BELNR>
</E1EDK01>
<E1EDKA1 SEGMENT="1">
<PARVW>AG</PARVW>
<LIFNR>B15</LIFNR>
<TELF1></TELF1>
<BNAME></BNAME>
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>WE</PARVW>
<LIFNR>B15</LIFNR>
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>LF</PARVW>
</E1EDKA1>
<E1EDK02 SEGMENT="1">
<QUALF>001</QUALF>
<BELNR>4505345253</BELNR>
<DATUM>20121102T00:00:00</DATUM>
<UZEIT>20121102T00:00:00</UZEIT>
</E1EDK02>
<E1EDP01 SEGMENT="1">
<POSEX>00001</POSEX>
<MENGE>1</MENGE>
<MENEE>EA</MENEE>
<VPREI>150.00</VPREI>
<NETWR></NETWR>
<CURCY>ZAR</CURCY>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>145416</IDTNR>
</E1EDP19>
<E1EDPT1 SEGMENT="1">
<TDID>ZERR</TDID>
<TSSPRAS_ISO>EN</TSSPRAS_ISO>
<E1EDPT2 SEGMENT="1">
<TDLINE>Description: GAS CYL DBL NOZZLE 48KG EM</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>UOM: EA</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Quantity: 1</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Unit Price: 150</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Customer Part Number: 145416</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2></E1EDPT1>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<POSEX>00002</POSEX>
<MENGE>1</MENGE>
<MENEE>EA</MENEE>
<VPREI>150.00</VPREI>
<NETWR></NETWR>
<CURCY>ZAR</CURCY>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>407303</IDTNR>
</E1EDP19>
<E1EDPT1 SEGMENT="1">
<TDID>ZERR</TDID>
<TSSPRAS_ISO>EN</TSSPRAS_ISO>
<E1EDPT2 SEGMENT="1">
<TDLINE>Description: GAS CYL DBL NOZZLE 48KG EM</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>UOM: EA</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Quantity: 1</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Unit Price: 150</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Customer Part Number: 407303</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2></E1EDPT1>
</E1EDP01>
<E1EDS01 SEGMENT="1">
<SUMID>001</SUMID>
<SUMME>1</SUMME>
</E1EDS01>
<E1EDS01 SEGMENT="1">
<SUMME>150.00</SUMME>
<WAERQ>ZAR</WAERQ>
</E1EDS01>
</IDOC>
This example will remove the 2nd line as this contains an item not to be removed by the xslt as well. It should process the 1st line only.
<?xml version="1.0" encoding="UTF-8"?>
<ORDERS05>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>ORDERS05</IDOCTYP>
<MESTYP>ORDERS</MESTYP>
<SNDPOR>SNDPOR</SNDPOR>
<SNDPRT>KU</SNDPRT>
<SNDPFC>AG</SNDPFC>
<SNDPRN>BWH</SNDPRN>
<RCVPOR>RCVPOR</RCVPOR>
<RCVPFC>LS</RCVPFC>
<RCVPRN>RCVPRN</RCVPRN>
</EDI_DC40>
<E1EDK01 SEGMENT="1">
<BSART>UB</BSART>
<BELNR>4504836702</BELNR>
</E1EDK01>
<E1EDKA1 SEGMENT="1">
<PARVW>AG</PARVW>
<LIFNR>1001600-S78</LIFNR>
<TELF1></TELF1>
<BNAME></BNAME>
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>WE</PARVW>
<LIFNR>1001600-S78</LIFNR>
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>LF</PARVW>
</E1EDKA1>
<E1EDK02 SEGMENT="1">
<QUALF>001</QUALF>
<BELNR>4504836702</BELNR>
<DATUM>20120423T00:00:00</DATUM>
<UZEIT>20120423T00:00:00</UZEIT>
</E1EDK02>
<E1EDP01 SEGMENT="1">
<POSEX>00001</POSEX>
<MENGE>100</MENGE>
<MENEE>EA</MENEE>
<VPREI>156.18</VPREI>
<NETWR></NETWR>
<CURCY>ZAR</CURCY>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>10220</IDTNR>
</E1EDP19>
<E1EDPT1 SEGMENT="1">
<TDID>ZERR</TDID>
<TSSPRAS_ISO>EN</TSSPRAS_ISO>
<E1EDPT2 SEGMENT="1">
<TDLINE>Description: GAS 9KG</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>UOM: EA</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Quantity: 100</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Unit Price: 156.18</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Customer Part Number: 10220</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
</E1EDPT1>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<POSEX>00002</POSEX>
<MENGE>1</MENGE>
<MENEE>EA</MENEE>
<VPREI>150.00</VPREI>
<NETWR></NETWR>
<CURCY>ZAR</CURCY>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>243</IDTNR>
</E1EDP19>
<E1EDPT1 SEGMENT="1">
<TDID>ZERR</TDID>
<TSSPRAS_ISO>EN</TSSPRAS_ISO>
<E1EDPT2 SEGMENT="1">
<TDLINE>Description: GAS EMPTY 9 KG</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>UOM: EA</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Quantity: 1</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Unit Price: 150</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
<E1EDPT2 SEGMENT="1">
<TDLINE>Customer Part Number: 243</TDLINE>
<TDFORMAT>*</TDFORMAT>
</E1EDPT2>
</E1EDPT1>
</E1EDP01>
<E1EDS01 SEGMENT="1">
<SUMID>001</SUMID>
<SUMME>2</SUMME>
</E1EDS01>
<E1EDS01 SEGMENT="1">
<SUMME>30618.00</SUMME>
<WAERQ>ZAR</WAERQ>
</E1EDS01>
</IDOC>
</ORDERS05>

You can achieve your result by double negating (you want to copy the root directly only there are NOT elements which are NOT in you materials list).
Here you have a sample transformation.
BTW: I made use of "map" variable to simplify the validations, like the one suggested in this post. In case you are using XSLT 2.0, you can simplify it a bit more following the idea on the same post (use a variable directly, instead of using document('')).
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mat="materials" exclude-result-prefixes="mat">
<xsl:output method="xml" indent="yes"/>
<mat:materials>
<IDTNR>407303</IDTNR>
<IDTNR>243</IDTNR>
<IDTNR>262</IDTNR>
<IDTNR>265</IDTNR>
<IDTNR>5624</IDTNR>
<IDTNR>145416</IDTNR>
</mat:materials>
<xsl:variable name="materials" select="document('')/*/mat:materials/IDTNR"/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="#*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<xsl:template match="E1EDP01[E1EDP19/IDTNR = $materials]"/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<xsl:template match="ORDERS05[not(IDOC/E1EDP01/E1EDP19[not(IDTNR=$materials)])]">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
I hope this helps!
Carles

Related

XSL to replace value by condition

I want to replace the contents of /SHPMNT05/IDOC/E1EDT20/E1EDL20/E1EDL37/E1EDL44/CUOBJ with the value of /SHPMNT05/IDOC/E1EDT20/E1EDL20/E1EDL24/E1EDL43/BELNR but the best I can get is a 'true' with my xsl transformation :(
My xml:
<SHPMNT05>
<IDOC BEGIN="1">
<E1EDT20 SEGMENT="1">
<TKNUM>0000287302</TKNUM>
<E1EDL20 SEGMENT="1">
<VBELN>0081018991</VBELN>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>000000000000009645</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196597</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL24 SEGMENT="1">
<POSNR>000020</POSNR>
<MATNR>000000000000009646</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196598</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247463</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000010</POSNR>
<CUOBJ>000000000000000000</CUOBJ>
</E1EDL44>
</E1EDL37>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247470</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000020</POSNR>
<VEMNG>5000.000</VEMNG>
<CUOBJ>000000000000000000</CUOBJ>
</E1EDL44>
</E1EDL37>
</E1EDL20>
</E1EDT20>
</IDOC>
</SHPMNT05>
My xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="node()|#*" mode="#all">
<xsl:copy>
<xsl:apply-templates select="node()|#*" mode="#current"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/SHPMNT05/IDOC/E1EDT20/E1EDL20/E1EDL37/E1EDL44/CUOBJ">
<CUOBJ> <xsl:value-of select="ancestor::node()[3]/VBELN=../VBELN and ancestor::node()[3]/E1EDL24/POSNR=../POSNR"/></CUOBJ>
<xsl:for-each select="//E1EDL44">
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Current result:
<SHPMNT05>
<IDOC BEGIN="1">
<E1EDT20 SEGMENT="1">
<TKNUM>0000287302</TKNUM>
<E1EDL20 SEGMENT="1">
<VBELN>0081018991</VBELN>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>000000000000009645</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196597</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL24 SEGMENT="1">
<POSNR>000020</POSNR>
<MATNR>000000000000009646</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196597</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247463</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000010</POSNR>
<CUOBJ>true</CUOBJ>
</E1EDL44>
</E1EDL37>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247470</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000020</POSNR>
<VEMNG>5000.000</VEMNG>
<CUOBJ>true</CUOBJ>
</E1EDL44>
</E1EDL37>
</E1EDL20>
</E1EDT20>
</IDOC>
</SHPMNT05>
Required result:
<SHPMNT05>
<IDOC BEGIN="1">
<E1EDT20 SEGMENT="1">
<TKNUM>0000287302</TKNUM>
<E1EDL20 SEGMENT="1">
<VBELN>0081018991</VBELN>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>000000000000009645</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196597</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL24 SEGMENT="1">
<POSNR>000020</POSNR>
<MATNR>000000000000009646</MATNR>
<E1EDL43 SEGMENT="1">
<BELNR>0003196598</BELNR>
</E1EDL43>
</E1EDL24>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247463</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000010</POSNR>
<CUOBJ>0003196597</CUOBJ>
</E1EDL44>
</E1EDL37>
<E1EDL37 SEGMENT="1">
<EXIDV>00387112831000247470</EXIDV>
<E1EDL44 SEGMENT="1">
<VBELN>0081018991</VBELN>
<POSNR>000020</POSNR>
<VEMNG>5000.000</VEMNG>
<CUOBJ>0003196598</CUOBJ>
</E1EDL44>
</E1EDL37>
</E1EDL20>
</E1EDT20>
</IDOC>
</SHPMNT05>
Link: https://xsltfiddle.liberty-development.net/aUPRNr
I'm afraid I made a mess with the ancestor::node()[3] part...
Each time I think I'learning something / know how 'to fix it' the challenge becomes too big :(
Update: forgot to mention. there can be more E1EDL44 than E1EDL24 elements. SAP Idoc always starts with E1EDL24 'lines' which shows the lines in a delivery. Then you get E1EDL37 Handling units below with 1 or more E1EDL44 lines on that handling unit. The relation between 24 and 44 is on POSNR.
Also there can be multiple E1EDL20 elements (deliveries) each with e.g. an E1EDL24 with POSNR 10. So the combination E1EDL20\VBELN E1EDL24\POSNR is unique. There is only one E1EDL43 in E1EDL24.
Kind regards,
Mike
-- edited in view of clarifications --
So, now that we know that there exists a cross-reference between E1EDL24 and E1EDL44 in the form of a common value of POSNR, we can use a key to implement a link between the two.
And, since the value of POSNR is unique only within the E1EDT20 branch, we need to include the unique id of the branch in the key:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="e1edl24" match="E1EDL24" use="concat(POSNR, '|', generate-id(ancestor::E1EDT20))" />
<!-- identity transform -->
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="CUOBJ">
<xsl:copy>
<xsl:value-of select="key('e1edl24', concat(../POSNR, '|', generate-id(ancestor::E1EDT20)))/E1EDL43/BELNR"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

XSL to Filter out elements without a correct 'qualifier'

It's me (again). I fail to filter an IDOC / xml where the E1EDL20 elements have E1ADRM1 elements without an AG PARTNER_Q. In other words I only want E1EDl20 nodes when there exists a E1ADRM\PARTNER_Q='AG'
Source XML:
<?xml version="1.0" encoding="UTF-8"?>
<SHPMNT05>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>100</MANDT>
</EDI_DC40>
<E1EDT20 SEGMENT="1">
<TKNUM>0000252060</TKNUM>
<E1EDK33 SEGMENT="1">
<TSNUM>0001</TSNUM>
</E1EDK33>
<E1EDL20 SEGMENT="1">
<VBELN>0081971127</VBELN>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>SP</PARTNER_Q>
<PARTNER_ID>0000005682</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>WE</PARTNER_Q>
<PARTNER_ID>0000012417</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSP</PARTNER_Q>
<PARTNER_ID>EWM</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSO</PARTNER_Q>
<PARTNER_ID>0200</PARTNER_ID>
</E1ADRM1>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>123</MATNR>
</E1EDL24>
</E1EDL20>
<E1EDL20 SEGMENT="1">
<VBELN>0081971128</VBELN>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>AG</PARTNER_Q>
<PARTNER_ID>0000003884</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>RE</PARTNER_Q>
<PARTNER_ID>0000004105</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>WE</PARTNER_Q>
<PARTNER_ID>0000012417</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSP</PARTNER_Q>
<PARTNER_ID>EWM</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSO</PARTNER_Q>
<PARTNER_ID>0200</PARTNER_ID>
</E1ADRM1>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>123</MATNR>
</E1EDL24>
</E1EDL20>
</E1EDT20>
</IDOC>
</SHPMNT05>
Required result only 'output' when partner_q = AG:
<?xml version="1.0" encoding="UTF-8"?>
<SHPMNT05>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>100</MANDT>
</EDI_DC40>
<E1EDT20 SEGMENT="1">
<TKNUM>0000252060</TKNUM>
<E1EDK33 SEGMENT="1">
<TSNUM>0001</TSNUM>
</E1EDK33>
<E1EDL20 SEGMENT="1">
<VBELN>0081971128</VBELN>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>AG</PARTNER_Q>
<PARTNER_ID>0000003884</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>RE</PARTNER_Q>
<PARTNER_ID>0000004105</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>WE</PARTNER_Q>
<PARTNER_ID>0000012417</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSP</PARTNER_Q>
<PARTNER_ID>EWM</PARTNER_ID>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSO</PARTNER_Q>
<PARTNER_ID>0200</PARTNER_ID>
</E1ADRM1>
<E1EDL24 SEGMENT="1">
<POSNR>000010</POSNR>
<MATNR>123</MATNR>
</E1EDL24>
</E1EDL20>
</E1EDT20>
</IDOC>
</SHPMNT05>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes" />
<!-- identity template -->
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<!-- override the above template for certain E1EDL20 elements; output nothing. -->
<xsl:template match="/*[//IDOC/SHPMNT05/E1EDL20[E1ADRM1[
not(PARTNER_Q = 'AG')]]]">
</xsl:template>
</xsl:stylesheet>
My xsl doesn't filter / is incorrect.
Kind regards,
Mike
To me it sounds as if you want e.g. <xsl:template match="E1EDL20[not(E1ADRM1/PARTNER_Q = 'AG')]"/>

XSLT copy-of doesn't match document

I'm receiving a large XML with many documents and I need to break it down to single documents for processing. I'm using XSLT. In the source /ACC_DOCUMENT04/IDOC is a recurring element, but in each result of the transform it would a singular.
I'm using XSLT 1.0 with an input parameter, and I've done similar ones before, but I cannot figure out why my transform doesn't find any data at all. This is my latest attempt: https://xsltfiddle.liberty-development.net/eixh2wH
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<ACC_DOCUMENT04>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>ACC_DOCUMENT04</IDOCTYP>
<MESTYP>ACC_DOCUMENT</MESTYP>
<MESFCT/>
<SNDPOR>SAPXQ1</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>MAGENTO</SNDPRN>
<RCVPOR>SAPEQ1</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>EQ1CLNT400</RCVPRN>
</EDI_DC40>
<E1BPACHE09 SEGMENT="1">
<OBJ_TYPE>BKPFF</OBJ_TYPE>
<OBJ_KEY>FB01</OBJ_KEY>
<BUS_ACT>RFBU</BUS_ACT>
<USERNAME>SAPPI</USERNAME>
<HEADER_TXT>SL000000601</HEADER_TXT>
<COMP_CODE>1713</COMP_CODE>
<DOC_DATE>20220701</DOC_DATE>
<PSTNG_DATE>20220701</PSTNG_DATE>
<TRANS_DATE>20220701</TRANS_DATE>
<FISC_YEAR>2022</FISC_YEAR>
<DOC_TYPE>ZM</DOC_TYPE>
<REF_DOC_NO>SL000001861</REF_DOC_NO>
</E1BPACHE09>
<E1BPACGL09 SEGMENT="1">
<ITEMNO_ACC>1</ITEMNO_ACC>
<GL_ACCOUNT>0012100050</GL_ACCOUNT>
<ITEM_TEXT>NK9HZT53LLBX8N82</ITEM_TEXT>
<REF_KEY_1>MC</REF_KEY_1>
<VALUE_DATE>20220701</VALUE_DATE>
<ALLOC_NMBR>SL000001861</ALLOC_NMBR>
</E1BPACGL09>
<E1BPACAR09 SEGMENT="1">
<ITEMNO_ACC>2</ITEMNO_ACC>
<CUSTOMER>0001077997</CUSTOMER>
<PAYMT_REF>SL000001861</PAYMT_REF>
<ALLOC_NMBR>SL000001861</ALLOC_NMBR>
<ITEM_TEXT>NK9HZT53LLBX8N82</ITEM_TEXT>
</E1BPACAR09>
<E1BPACCR09 SEGMENT="1">
<ITEMNO_ACC>1</ITEMNO_ACC>
<CURRENCY>USD</CURRENCY>
<AMT_DOCCUR>14.65</AMT_DOCCUR>
</E1BPACCR09>
<E1BPACCR09 SEGMENT="1">
<ITEMNO_ACC>2</ITEMNO_ACC>
<CURRENCY>USD</CURRENCY>
<AMT_DOCCUR>-14.65</AMT_DOCCUR>
</E1BPACCR09>
</IDOC>
<IDOC BEGIN="2">
<EDI_DC40 SEGMENT="2">
<TABNAM>EDI_2</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>ACC_DOCUMENT04</IDOCTYP>
<MESTYP>ACC_DOCUMENT</MESTYP>
<MESFCT/>
<SNDPOR>SAPXQ1</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>MAGENTO</SNDPRN>
<RCVPOR>SAPEQ1</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>EQ1CLNT400</RCVPRN>
</EDI_DC40>
<E1BPACHE09 SEGMENT="1">
<OBJ_TYPE>BKPFF</OBJ_TYPE>
<OBJ_KEY>FB01</OBJ_KEY>
<BUS_ACT>RFBU</BUS_ACT>
<USERNAME>SAPPI</USERNAME>
<HEADER_TXT>SL000000598</HEADER_TXT>
<COMP_CODE>1713</COMP_CODE>
<DOC_DATE>20220701</DOC_DATE>
<PSTNG_DATE>20220701</PSTNG_DATE>
<TRANS_DATE>20220701</TRANS_DATE>
<FISC_YEAR>2022</FISC_YEAR>
<DOC_TYPE>ZM</DOC_TYPE>
<REF_DOC_NO>SL000001864</REF_DOC_NO>
</E1BPACHE09>
<E1BPACGL09 SEGMENT="1">
<ITEMNO_ACC>1</ITEMNO_ACC>
<GL_ACCOUNT>0012100050</GL_ACCOUNT>
<ITEM_TEXT>W82RKHDLHRWZNN82</ITEM_TEXT>
<REF_KEY_1>MC</REF_KEY_1>
<VALUE_DATE>20220701</VALUE_DATE>
<ALLOC_NMBR>SL000001864</ALLOC_NMBR>
</E1BPACGL09>
<E1BPACAR09 SEGMENT="1">
<ITEMNO_ACC>2</ITEMNO_ACC>
<CUSTOMER>0001077997</CUSTOMER>
<PAYMT_REF>SL000001864</PAYMT_REF>
<ALLOC_NMBR>SL000001864</ALLOC_NMBR>
<ITEM_TEXT>W82RKHDLHRWZNN82</ITEM_TEXT>
</E1BPACAR09>
<E1BPACCR09 SEGMENT="1">
<ITEMNO_ACC>1</ITEMNO_ACC>
<CURRENCY>USD</CURRENCY>
<AMT_DOCCUR>56.21</AMT_DOCCUR>
</E1BPACCR09>
<E1BPACCR09 SEGMENT="1">
<ITEMNO_ACC>2</ITEMNO_ACC>
<CURRENCY>USD</CURRENCY>
<AMT_DOCCUR>-56.21</AMT_DOCCUR>
</E1BPACCR09>
</IDOC>
</ACC_DOCUMENT04>
Transform:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="Doc" select="SL000000598" />
<xsl:template match="/ACC_DOCUMENT04">
<ACC_DOCUMENT04>
<xsl:copy-of select="./IDOC[E1BPACHE09/HEADER_TXT=$Doc]"/>
</ACC_DOCUMENT04>
</xsl:template>
</xsl:stylesheet>
The expected output would be just the second IDOC, so abbreviated:
<?xml version="1.0" encoding="UTF-8"?>
<ACC_DOCUMENT04>
<IDOC BEGIN="2">
...
<E1BPACHE09 SEGMENT="1">
...
<HEADER_TXT>SL000000598</HEADER_TXT>
<REF_DOC_NO>SL000001864</REF_DOC_NO>
...
</E1BPACHE09>
...
</IDOC>
</ACC_DOCUMENT04>
Change:
<xsl:param name="Doc" select="SL000000598" />
to:
<xsl:param name="Doc" select="'SL000000598'" />
or:
<xsl:param name="Doc">SL000000598"</xsl:param>
What you have now is looking for a root element named SL000000598.
Note that there should be no problem if you leave it as it is - or change it to <xsl:param name="Doc"/> - and pass the value as the parameter at runtime. It's only your hard-coded test that fails.

Condition based filtering for the target field

Below is my xml input
<?xml version="1.0" encoding="UTF-8"?>
<DELVRY07>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>100</MANDT>
</EDI_DC40>
<E1EDL20 SEGMENT="1">
<VBELN>0080000646</VBELN>
<VSTEL>1710</VSTEL>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>AG</PARTNER_Q>
<PARTNER_ID>0017100001</PARTNER_ID>
<JURISDIC>GA00000000</JURISDIC>
<LANGUAGE>EN</LANGUAGE>
<FORMOFADDR>Company</FORMOFADDR>
<NAME1>Domestic US Customer 1</NAME1>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>SP</PARTNER_Q>
<PARTNER_ID>PL1047</PARTNER_ID>
<LANGUAGE>EN</LANGUAGE>
<NAME1>W. L. GORE & ASSOCIATES, INC</NAME1>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>WE</PARTNER_Q>
<PARTNER_ID>0017100001</PARTNER_ID>
<JURISDIC>GA00000000</JURISDIC>
<LANGUAGE>EN</LANGUAGE>
<FORMOFADDR>Company</FORMOFADDR>
<NAME1>Domestic US Customer 1</NAME1>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSP</PARTNER_Q>
<PARTNER_ID>1710</PARTNER_ID>
<JURISDIC>7700000000</JURISDIC>
<LANGUAGE>EN</LANGUAGE>
<NAME1>Shipping Point 1710 - Address Name 1</NAME1>
</E1ADRM1>
<E1ADRM1 SEGMENT="1">
<PARTNER_Q>OSO</PARTNER_Q>
<PARTNER_ID>1710</PARTNER_ID>
<JURISDIC>7700000000</JURISDIC>
<LANGUAGE>EN</LANGUAGE>
<NAME1>Sales Organization 1710 - Address Name 1</NAME1>
</E1ADRM1>
</E1EDL20></IDOC></DELVRY07>
in the above xml I need to filter out the condtion for PARTNER_Q. if PARTNER_Q =WE then pass the value of related NAME1 field value to the target.
I have tried below XSL code but not able get the correct logic for filtering
<xsl:variable name="vPartnerfunction" select="$nodes_in/PARTNER_Q"/>
<xsl:variable name="vName" select="$nodes_in/NAME1"/>
<xsl:choose>
<xsl:when test="$vPartnerfunction = 'WE'">
<xsl:value-of select="$vName"/>
</xsl:when>
</xsl:choose>
Please help me out on this.
In the output only i should get the below value
<NAME1>Domestic US Customer 1</NAME1>
The result you show can be produced quite easily by:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/DELVRY07">
<xsl:copy-of select="IDOC/E1EDL20/E1ADRM1[PARTNER_Q='WE']/NAME1"/>
</xsl:template>
</xsl:stylesheet>
However, if there are more than one E1ADRM1 element that meets the condition, the result will be an XML fragment - not a well-formed XML document.

Mule-XSLT transformation failing

I am trying to transform an XML in Mule before calling my JDBC connector, however the transformation is failing with :
ERROR 2013-02-05 14:43:53,989 [WrapperListener_start_runner] org.mule.module.launcher.application.DefaultMuleApplication: null
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
This is even before I pass in the XML, here is the Mule Configuration:
<jms:inbound-endpoint topic="${topic.logTopic}" connector-ref="jmsConnector" doc:name="JMS">
<jms:transaction action="NONE" timeout="${queue.transaction.timeout}" />
</jms:inbound-endpoint>
<mule-xml:xslt-transformer outputEncoding="UTF-8" ignoreBadInput="false" encoding="UTF-8">
<mule-xml:xslt-text>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="ZLOIPRO1" >
<table>
<th><td>ZLOIPRO1</td></th>
<xsl:apply-templates select="data"/>
</table>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="TABNAME">
<xsl:value-of select="$TABNAM"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="MANDT">
<xsl:value-of select="$MANDT"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="DOCNUM">
<xsl:value-of select="$DOCNUM"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="DOCREL">
<xsl:value-of select="$DOCREL"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="STATUS">
<xsl:value-of select="$STATUS"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="data" >
<xsl:attribute name="DIRECT">
<xsl:value-of select="$DIRECT"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
</mule-xml:xslt-text>
</mule-xml:xslt-transformer>
<object-to-string-transformer/>
<jdbc:xml-to-maps-transformer name="XMLToMaps"/>
<jdbc:outbound-endpoint queryKey="insertion" connector-ref="insertionConnector">
Here is my XML:
<ZLOIPRO1>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>300</MANDT>
<DOCNUM>0000000000705856</DOCNUM>
<DOCREL>640</DOCREL>
<STATUS>30</STATUS>
<DIRECT>1</DIRECT>
<OUTMOD>2</OUTMOD>
<EXPRSS />
<TEST />
<IDOCTYP>LOIPRO01</IDOCTYP>
<CIMTYP>ZLOIPRO1</CIMTYP>
<MESTYP>LOIPRO</MESTYP>
<MESCOD />
<MESFCT />
<STD />
<STDVRS />
<STDMES />
<SNDPOR>SAPR3P</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPFC />
<SNDPRN>R3PCLNT300</SNDPRN>
<SNDSAD />
<SNDLAD />
<RCVPOR>5555</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPFC />
<RCVPRN>SBCR3P300</RCVPRN>
<RCVSAD />
<RCVLAD />
<CREDAT>20120512</CREDAT>
<CRETIM>182139</CRETIM>
<REFINT />
<REFGRP />
<REFMES />
<ARCKEY />
<SERIAL>20120512182139</SERIAL>
</EDI_DC40>
<E1AFKOL SEGMENT="1">
<AUFNR>8390</AUFNR>
<APROZ>0.00</APROZ>
<AUART>ZP01</AUART>
<AUFLD>20120605</AUFLD>
<AUTYP>10</AUTYP>
<BAUMNG>1.0000</BAUMNG>
<BMEINS>EA</BMEINS>
<BMENGE>1.0000</BMENGE>
<CY_SEQNR>00000000000000</CY_SEQNR>
<DISPO>401</DISPO>
<FHORI>000</FHORI>
<FREIZ>000</FREIZ>
<FTRMI>00000000</FTRMI>
<FTRMS>20120619</FTRMS>
<GAMNG>1.0000</GAMNG>
<GASMG>1.0000</GASMG>
<GETRI>00000000</GETRI>
<GEUZI>000000</GEUZI>
<GLTRI>00000000</GLTRI>
<GLTRP>20120619</GLTRP>
<GLTRS>20120619</GLTRS>
<GLUZP>000000</GLUZP>
<GLUZS>000000</GLUZS>
<GMEIN>EA</GMEIN>
<GSTRI>00000000</GSTRI>
<GSTRP>20120619</GSTRP>
<GSTRS>20120619</GSTRS>
<GSUZP>000000</GSUZP>
<GSUZS>000000</GSUZS>
<IASMG>0.000</IASMG>
<IGMNG>0.000</IGMNG>
<LODIV>0.000</LODIV>
<MATNR>1007012-04-C</MATNR>
<PLAUF>20120605</PLAUF>
<PLNAL>1</PLNAL>
<PLNME>EA</PLNME>
<PLNNR>50000147</PLNNR>
<PLNTY>N</PLNTY>
<PLSVB>99999999.000</PLSVB>
<PLSVN>1.000</PLSVN>
<PSPEL>00000000</PSPEL>
<RMNGA>0.000</RMNGA>
<SBMNG>0.000</SBMNG>
<SICHZ>000</SICHZ>
<SLSBS>0.000</SLSBS>
<SLSVN>0.000</SLSVN>
<TERKZ>2</TERKZ>
<VORGZ>000</VORGZ>
<WERKS>3100</WERKS>
<E1JSTKL SEGMENT="1">
<STAT>E0006</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0001</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0016</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0028</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0115</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0215</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0291</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0361</STAT>
</E1JSTKL>
<E1JSTKL SEGMENT="1">
<STAT>I0420</STAT>
</E1JSTKL>
<E1AFFLL SEGMENT="1">
<APLZL>00000001</APLZL>
<AUSCHL>2</AUSCHL>
<FLGAT>0</FLGAT>
<PLNFL>0</PLNFL>
<E1AFVOL SEGMENT="1">
<VORNR>0010</VORNR>
<ABRUE>0.000000000000000E+00</ABRUE>
<ANZZL>0</ANZZL>
<ARBEI>0.0</ARBEI>
<ARBID>10000031</ARBID>
<ARUZE>HUR</ARUZE>
<AUFAK>0.000</AUFAK>
<BEARZ>0.000000000000000E+00</BEARZ>
<BEAZE>HUR</BEAZE>
<BMSCH>1.000</BMSCH>
<CY_SEQNRV>00000000000000</CY_SEQNRV>
<DAUNO>0.0</DAUNO>
<DAUMI>0.0</DAUMI>
<FSAVD>20120619</FSAVD>
<FSAVZ>000000</FSAVZ>
<FSEDD>20120619</FSEDD>
<FSEDZ>000000</FSEDZ>
<FSELD>20120619</FSELD>
<FSELZ>000000</FSELZ>
<FSEVD>20120619</FSEVD>
<FSEVZ>000000</FSEVZ>
<FSSAD>20120619</FSSAD>
<FSSAZ>000000</FSSAZ>
<FSSBD>20120619</FSSBD>
<FSSBZ>000000</FSSBZ>
<FSSLD>20120619</FSSLD>
<FSSLZ>000000</FSSLZ>
<KALID>US</KALID>
<LAR01>LAB02</LAR01>
<LAR02>LAB01</LAR02>
<LIEGZ>0.000000000000000E+00</LIEGZ>
<LMNGA>0.000</LMNGA>
<LTXA1>General Assembly</LTXA1>
<MEINH>EA</MEINH>
<MINWE>0.000</MINWE>
<MGVRG>1.000</MGVRG>
<PEINH>0</PEINH>
<PREIS>0.00</PREIS>
<PRZNT>0</PRZNT>
<RMNGA>0.000</RMNGA>
<RSTZE>HUR</RSTZE>
<RUEST>0.000000000000000E+00</RUEST>
<SPLIM>0</SPLIM>
<SSAVD>20120619</SSAVD>
<SSAVZ>000000</SSAVZ>
<SSEDD>20120619</SSEDD>
<SSEDZ>000000</SSEDZ>
<SSELD>20120619</SSELD>
<SSELZ>000000</SSELZ>
<SSEVD>20120619</SSEVD>
<SSEVZ>000000</SSEVZ>
<SSSAD>20120619</SSSAD>
<SSSAZ>000000</SSSAZ>
<SSSBD>20120619</SSSBD>
<SSSBZ>000000</SSSBZ>
<SSSLD>20120619</SSSLD>
<SSSLZ>000000</SSSLZ>
<STEUS>PP03</STEUS>
<TRANZ>0.000000000000000E+00</TRANZ>
<USR04>0.000</USR04>
<USR05>0.000</USR05>
<VGE01>HUR</VGE01>
<VGE02>HUR</VGE02>
<VGW01>0.000</VGW01>
<VGW02>5.000</VGW02>
<VGW03>0.000</VGW03>
<VGW04>0.000</VGW04>
<VGW05>0.000</VGW05>
<VGW06>0.000</VGW06>
<VGWTS>Z001</VGWTS>
<WARTZ>0.000000000000000E+00</WARTZ>
<XMNGA>0.000</XMNGA>
<ZLPRO>0.000</ZLPRO>
<ZMINB>0.000</ZMINB>
<ZMINU>0.000</ZMINU>
<ZTMIN>0.000</ZTMIN>
<ZWMIN>0.000</ZWMIN>
<ZWNOR>0.000</ZWNOR>
<ISAVD>00000000</ISAVD>
<IEAVD>00000000</IEAVD>
<ISDD>00000000</ISDD>
<ISDZ>000000</ISDZ>
<IEDD>00000000</IEDD>
<IEDZ>000000</IEDZ>
<ANZMA>0.00</ANZMA>
<E1JSTVL SEGMENT="1">
<STAT>I0001</STAT>
</E1JSTVL>
</E1AFVOL>
</E1AFFLL>
<E1AFPOL SEGMENT="1">
<POSNR>0001</POSNR>
<AMEIN>EA</AMEIN>
<BMENG>0.000</BMENG>
<KDAUF>1000021859</KDAUF>
<KDEIN>0000</KDEIN>
<KDPOS>000010</KDPOS>
<MATNR>1007012-04-C</MATNR>
<MEINS>EA</MEINS>
<PLNUM>2718553</PLNUM>
<PSAMG>0.000</PSAMG>
<PSMNG>1.000</PSMNG>
<UMREN>1</UMREN>
<UMREZ>1</UMREZ>
<WEBAZ>0</WEBAZ>
<WEMNG>0.000</WEMNG>
<ZE1AFPO SEGMENT="1">
<ZATWTB>IZMT</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>IDCF</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>PPSR</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>PF01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>RFPO</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TR01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>WT21</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>CH01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>AU01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TP01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>PS01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X019</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X024</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TM01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>AD02</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>SU01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>BT85</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>CC00</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>CN01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>DRLH</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>RENA</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>AU01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>BT85</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>CH01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>HP01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>PPSR</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>PS01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>RFPO</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>SC01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>SU01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TM01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TP01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>TR01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>WT21</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>SC01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>HP01</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X013</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X001</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X007</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X011</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X003</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X015</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X005</ZATWTB>
</ZE1AFPO>
<ZE1AFPO SEGMENT="1">
<ZATWTB>X009</ZATWTB>
</ZE1AFPO>
</E1AFPOL>
</E1AFKOL>
</IDOC>
</ZLOIPRO1>
Any suggestions?
With Regards
Sri
I am unfamiliar with Mule, so take this with a grain of salt.
Your error message is from a SAX parser, so someone is trying to read some data they expect to be XML. You say you get the error message even before you try to pass in the XML input, so we can guess that the problem is not in the input. You provide a Mule configuration file -- configuration files often get read early, so an error in a configuration file seems like a plausible diagnosis. And the configuration file you provide is not well formed XML: it lacks a root element, it uses four namespace prefixes that are not bound to namespaces (jms, doc, mule-xml, and jdbc), and the jdbc:outbound-endpoint element at the end has no end-tag. That input could easily elicit the error message you give, from a SAX parser.
So one plausible theory is that the problem is in your configuration file.
"Content is not allowed in prolog" usually means that something is wrong with your XML. In this case, the problem may be that your mule configuration file lacks of a root element, the mule tag. Here is an example in mule 3.2 (may not apply specifically for your needs since you use other components (jms, xsl etc..) and may use another version of the framework)
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mxml="http://www.mulesoft.org/schema/mule/xml"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:spring="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">