cancel
Showing results for 
Search instead for 
Did you mean: 

message-mapping: sort with subnodes

Former Member
0 Kudos

Hello everybody,

as far as i know (and tested) the SORT-function sorts just the node. The subnodes are not sorted.

Sample:

<B>

<BField_1>

<BField_2>

<A>

<AField_1>

<AField_2>

<u>after using the SORT:</u>

<A>

<<b>B</b>Field_1>

<<b>B</b>Field_2>

<B>

<<b>A</b>Field_1>

<<b>A</b>Field_2>

<u>what I want:</u>

<A>

<AField_1>

<AField_2>

<B>

<BField_1>

<BField_2>

Thanks, Regards

Mario

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Mario,

if nothing else works: xsl:sort is sorting <b>WITH</b> subnodes.

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

thanks a lot.

I was afraid of this answer

--> We got a IDOC with 1500 fields!

Regards Mario

udo_martens
Active Contributor
0 Kudos

Hi Mario,

i can understand you very good. I had that problem serveral times, a difficult task in message mapping or manually work in XSL.

One trick: download the xsd from the imported IDoc and put it into XML Spy where you have a function for creating a instance. Copy that xml into the stylesheet / template. So you have the not dynamical parts with less work.

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

Danke vorab.

1) My first problem is: I did some transformations from XML to HTML, cause all tutorials you find on the internet are xml -> html

In this special case (xml -> html), i see that the xml-<tags> get lost!

Could you tell me, how this behaves by a xml -> xml (better xsd -> xsd) mapping?

2) Is it possible to generate a xsl, that maps all source fields to target fields 1:1. Because this is the most work to do

Regards Mario

udo_martens
Active Contributor
0 Kudos

Hi Mario

xml -> xml: take xsl:stylesheet subelement "xsl:output" for control (method="xml")

xsd -> xsd: not possible. You need a instance for a mapping (should be clear as you dont have field values)

map all source fields to target fields 1:1: take xsl:copy-of. Use attribute select. Put there a X-Path expression, for example '/', what means everything (but why do you use a mapping at all??)

The copy-of command is very strong as you can copy well selected parts of your source message with very less code, just a little bit X-Path.

Regards,

Udo

Answers (0)