on 01-13-2009 6:58 AM
hi.. I have a XLST using 'for-each-group'.
When I use Altova XMLSpy, my XLST works fine, but when I import it to XI, it executes successfully, but it has no output.
Does anyone know why?
I can't figure out why it doesn't work in XI. Am I missing anything?
It works fine in XMLSpy.
****Source:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Abc xmlns:ns0="http://test.com">
<PO>
<PO_Item>
<field1>111</field1>
<PO_Number>b</PO_Number>
<field3>b1</field3>
</PO_Item>
<PO_Item>
<field1>111</field1>
<PO_Number>b</PO_Number>
<field3>b2</field3>
</PO_Item>
<PO_Item>
<field1>111</field1>
<PO_Number>c</PO_Number>
<field3>c1</field3>
</PO_Item>
</PO>
</ns0:MT_Abc>
***MY XLST
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet version="2.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="PO">
<ns0:MT_Abc xmlns:ns0="http://test.com">
<xsl:for-each-group select="PO_Item" group-by="PO_Number">
<PO>
<xsl:for-each select="current-group()">
<xsl:copy-of select="."/>
</xsl:for-each>
</PO>
</xsl:for-each-group>
</ns0:MT_Abc>
</xsl:template>
</xsl:stylesheet>
******my output
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Abc xmlns:ns0="http://test.com">
<PO>
<PO_Item>
<field1>111</field1>
<PO_Number>b</PO_Number>
<field3>b1</field3>
</PO_Item>
<PO_Item>
<field1>111</field1>
<PO_Number>b</PO_Number>
<field3>b2</field3>
</PO_Item>
</PO>
<PO>
<item>
<field1>111</field1>
<PO_Number>c</PO_Number>
<field3>c1</field3>
</item>
</PO>
</ns0:MT_Abc>
XI does not support XSLT 2.0.
Use only XSLT 1.1 statements.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your replies.
Prasad Nemalikanti,
I tried your code, but it didn't group the output by PO_Number.
As Stefan stated, XI apparently doesn't support XLS Stylesheet 2.0
Stefan,
I came to realize that. It's not a problem. I got around it by creating a preceding Message Mapping that groups the data by PO_Number.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Please try this xslt:
<!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Prasad Nemalikanti (Fujits) -->
<!-- Author: Prasad Babu Nemalikanti-->
<!-- Date:13-Jan-2009 -->
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <!xmlns:sap="http://www.sap.com/sapxsl">>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<ns0:MT_Abc xmlns:ns0="http://test.com">
<PO>
<xsl:for-each select="ns0:MT_Abc/PO/PO_Item">
<PO_Item>
<xsl:element name="field1">
<xsl:value-of select="field1"/>
</xsl:element>
<xsl:element name="PO_Number">
<xsl:value-of select="PO_Number"/>
</xsl:element>
<xsl:element name="field3">
<xsl:value-of select="field3"/>
</xsl:element>
</PO_Item>
</xsl:for-each>
</PO>
</ns0:MT_Abc>
</xsl:template>
</xsl:transform>
Hope it may help you.
Thanks
Prasad Nemalikanti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.