on 01-11-2006 10:07 AM
Hello,
I need to sort idocs in XI by value of a field that is in idoc. I can use SORTBYKEY in mapping, but I need to use this function in all fields of idoc. Is there a possibility to do this more easily?
I also tried to sort context, but it is not working.
Thanks in advance,
Cédric
Hi Cedric,
You can refer these links to get more info on XSLT mapping:
http://www.topxml.com/xsl/tutorials/intro/xsl10.asp
http://www.w3schools.com/xsl/default.asp
Cheers,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Stefan, Prashant,
Have you got an example of XSLT code to sort, please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a description for sort in XSLT:
http://www.w3schools.com/xsl/el_sort.asp
An example:
source XML:
<ORDERLIST>
<ITEM>
<ID>870</ID>
<PRODUCT>Sulphuric Acid</PRODUCT>
</ITEM>
<ITEM>
<ID>850</ID>
<PRODUCT>Pyridine CDE</PRODUCT>
</ITEM>
<ITEM>
<ID>880</ID>
<PRODUCT>Diamino Toluene</PRODUCT>
</ITEM>
<ITEM>
<ID>860</ID>
<PRODUCT>Cyanuric Chloride</PRODUCT>
</ITEM>
<ITEM>
<ID>890</ID>
<PRODUCT>Sodium Nitrate</PRODUCT>
</ITEM>
</ORDERLIST>
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ORDERLIST>
<xsl:for-each select="ORDERLIST/ITEM">
<<b>xsl:sort</b> select="ID"/>
<xsl:copy-of select="."/>
</xsl:for-each>
</ORDERLIST>
</xsl:template>
</xsl:stylesheet>
Hope that helps,
Stefan
Hi Cedric,
You can use XSL mapping for doing this easier. Try to sort using the value-of param in XSL.
cheers,
Prash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Inside the mapping tool I see no possibility to sort nodes besides assigning the sortByKey function to all subnodes and elements.
What is the source/target of the mapping?
If you have flat file -> IDOC, it might be easier to sort the flat file before the conversion.
Another idea is: Create the IDOC structure with graphical mapping tool without sorting, then write a Java Mapping with DOM parser.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.