cancel
Showing results for 
Search instead for 
Did you mean: 

XSL Mapping: Get node without complete XPath

former_member296836
Participant
0 Kudos

Dear all,

I would like to create a generic XSL mapping

In the target structure I would like to insert the value of DOCNUM

<xsl:template match="DOCNUM">

<xsl:value-of select="/ORDERS/IDOC/EDI_DC40/DOCNUM" />

</xsl:template>

That works.

Now, the mapping should become generic. I would like to use this for ORDERS, DELVRY and so on.

I try tor create it this way.

<xsl:value-of select="/../IDOC/EDI_DC40/DOCNUM" />

<xsl:value-of select="/IDOC/EDI_DC40/DOCNUM" />

<xsl:value-of select="/DOCNUM" />

So I don't want to use ORDERS in the select statement.

How to get this work for all IDOC types?

Regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Christian,

I understand you want to refer DOCNUM which is under ORDERS, DELVRY and so on.

Below statement will refer DOCNUM in entire XML (it can be any where).

<xsl:value-of select="//DOCNUM" />

I think, now you want it to be more specific, please refer this [Link1|http://www.zvon.org/xxl/XSLTutorial/Output/example70_ch17.html ], you can help your self.

Regards,

Raghu_Vamsee

former_member296836
Participant
0 Kudos

@Raghu_Vamsee

Your solution works.

@Rodrigo Alejandro Pertierra

I also tried your solutions, but it doesn't worked. I don't know why.

But thanks for your reply.

Points given.

Thanks

Chris

Answers (1)

Answers (1)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

just define this

SOURCE

<?xml version="1.0" encoding="UTF-8"?>

<XXXXXXX>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<TABNAM>EDI_DC40</TABNAM>

<MANDT>310</MANDT>

<DOCNUM>0000000001021184</DOCNUM>

<DOCREL>XX</DOCREL>

<STATUS>XX</STATUS>

<DIRECT>1</DIRECT>

</EDI_DC40>

</IDOC>

</XXXXXXX>

XLS

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="IDOC">

<DOCNUM>

<xsl:value-of select="EDI_DC40/DOCNUM" />

</DOCNUM>

</xsl:template>

</xsl:stylesheet>

RESULT

<?xml version="1.0" encoding="UTF-8"?>

<DOCNUM>0000000001021184</DOCNUM>

Thanks

Edited by: Rodrigo Alejandro Pertierra on Feb 3, 2011 2:28 PM