タイプ「汎用参照」のフィールドを持つ内部テーブルのABAPへのXSLT変換

プロローグ



についてのメモは何ですか? 内部テーブルからのように、その行には未知の(一般化された)タイプ(REF TO DATA)へのリンクが含まれ、実際には同じテーブルへのリンクが格納され、特定の形式のXMLを取得します。 さらに、ネストレベルの数は最初は不明です。

なぜこれが必要ですか? OLEを使用せずにさまざまなMS Office XMLファイル形式にデータをアップロードするときに、これが必要でした。

このメモは誰のためのものですか? ABAPのプログラマ向け。

必要な知識レベル: 参照型ジェネリック型XMLとは何かを知るため。 XSLTのようなものがあると聞きます



これに対処する方法は?



挑戦する


木があります。 ツリーは内部テーブルに保存されます。 テーブルのタイプは次のように定義されます。

TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data "    , END OF tdeep_struct , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY .
      
      







つまり rf_child_list



フィールドのテーブル行の構造には、ジェネリック型へのリンクが含まれています。



このような構造の内部テーブルから、次の形式のXMLを取得する必要があります。

 <List> <MyItem> <Name>  </Name> </MyItem> <MyItem> <Name>  </Name> </MyItem> </List>
      
      







この場合、結果のXMLのソースツリーのノードの場所は、降順のツリートラバーサルに対応する必要があります(つまり、内部テーブルのレコードを上から表示し始めますrf_child_list



に依存レコードがある場合、最初のレコードの内容を表示します。依存するものがあります-次に、それらを推定します)。



テストケース


次のツリーが内部テーブルに保存されているとします([名前]フィールドの値がリストされています):

 GrandParent1 Child1 Child2 GrandChild1 GrandParent2
      
      





タスクの条件に従って、このデータからこのようなXMLを取得する必要があります。

テストケースの最終XML
 <List> <MyItem> <Name> GrandParent1</Name> </MyItem> <MyItem> <Name>Child1 </Name> </MyItem> <MyItem> <Name>Child2 </Name> </MyItem> <MyItem> <Name>GrandChild1 </Name> </MyItem> <MyItem> <Name> GrandParent2</Name> </MyItem> </List>
      
      







解決策


簡単なものから始めましょう:ABAPコード、もっと簡単なものは何ですか?



内部テーブルにテストデータを定義して記入する
 DATA : gt_tree TYPE t_deep_struct "  , gtree TYPE tdeep_struct "     , gchild TYPE tdeep_struct "     , ggrandchild TYPE tdeep_struct "     . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct "     , <gt_grandchild_list> TYPE t_deep_struct "     . START-OF-SELECTION. gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree.
      
      









問題を解決して、XSLT変換を使用する必要があると考えました。 このメモのタグは「初心者向けXSLT」だったので、それが何であるかを言及する必要があります。 あなたの指ですべての場合、これは1つのXMLから別のXMLを取得できるようにするような言語です。 ただし、XSLT自体はXMLのサブセットです。 やめて! 内部テーブルは、XMLを変換する場合、どこで使用されますか? これは、SAPでのXSLT実装のこのような機能です。 もっと詳しく見てみましょう。



ABAPの変換演算子は、 CALL TRANSFORMATIONステートメントを担当します。 多くのオプションと多くの作業オプションがあります。

SOURCE _ = __



指定して、変換が必要な入力データを送信します。

結果は、 RESULT XML XML/ //



指定することで取得できRESULT XML XML/ //



。 簡単にするために、結果を文字列で取得します。



CL_XML_DOCUMENTオブジェクトの標準手段を使用して、画面に変換の結果を表示します。

次のコードを取得します。

  CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).
      
      







そうそう...私は気が散っている! 問題は、1つのXMLを別のXMLに変換するための変換である場合、変換はそれと何の関係があるのでしょうか?



ビットRTFM


まず、SAPは変換を使用してデータをシリアルおよび逆シリアル化します。 つまり、データオブジェクト(構造、内部テーブル、オブジェクト)から、ビットシーケンスの形式で表現を取得する方法、およびその逆。 シリアル化のタスクのみがあります。入力はネストされた構造(内部ABAPテーブル)であり、出力はXML(テキスト表現)です。

SAPには2種類のXSLTがあります。通常のXSLTと単純な変換(ST)です。 SAPは小さなXSLTのようであり、彼はXSLTのサブセットを実装しました。 私たちには合わない 入力パラメーターのジェネリック型フィールドを使用することはできません。

純粋なXSLTのままです。

SAPは、XSLTを使用してシリアル化を実行するときに、入力変換パラメーターをasXML( 標準XML表現 )形式に変換します。 この変換のプロセスでは、 特定のルールに従って 、ABAP型が変換されます。これはジェネリック型にも適用されます( 予約名IDを使用したABAP XSLTの標準変換を使用して、変数の正規表現を明示的に取得できます )。

変換中のデータ変換を説明するABAPヘルプイメージ

シリアル化の方向に興味があります



私の例では、正規のXML表現は次のとおりです。
 <?xml version="1.0" encoding="utf-8" ?> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> <asx:values> <TABLE> <item> <NAME>GrandParent1</NAME> <RF_CHILD_LIST href="#d1" /> </item> <item> <NAME>GrandParent2</NAME> <RF_CHILD_LIST /> </item> </TABLE> </asx:values> <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <prg:T_DEEP_STRUCT id="d1" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM"> <item> <NAME>Child1</NAME> <RF_CHILD_LIST /> </item> <item> <NAME>Child2</NAME> <RF_CHILD_LIST href="#d2" /> </item> </prg:T_DEEP_STRUCT> <prg:T_DEEP_STRUCT id="d2" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM"> <item> <NAME>GrandChild1</NAME> <RF_CHILD_LIST /> </item> </prg:T_DEEP_STRUCT> </asx:heap> </asx:abap>
      
      









そして、さらにそれと一緒に暮らす方法は?


内部テーブルのXMLの正規表現を受信すると、テーブル自体が要素に変換され、 , . . .. RF_CHILD_LIST , DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT












, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








 ,         .           . ..      RF_CHILD_LIST
      
      



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








, . . .. RF_CHILD_LIST



, DATA ( TYPE REF TO DATA



), , href



, .

, <RF_CHILD_LIST href="#d1" />



, #



- XLink , d1



– . XML-: asx:heap



, id



d1. < prg:T_DEEP_STRUCT id="d1" … >



. , .

.., XML , .



XSLT- ?

XSLT-.

SAP STRANS.



, «»(F5).



– , ( – XSLT). Enter.



XSLT, . , , – .



, .., , ( , , , html ).



, , .. .

<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="/"> </xsl:template> </xsl:transform>







:

xmlns:xsl



, xsl. .. , xsl



: ( <xsl:strip-space elements="*"/>



) xmlns:sap



, sap xsl:transform



, XSLT- <xsl:strip-space elements="*"/>



<xsl:template match="/">



, XML



XSLT- ( xsl:template



) XML-, match



. match



XPath . , «/», XML- TABLE



"/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



) ( TABLE



)).



, XML- List. :

<xsl:template match="/"> <List> </List> </xsl:template>







item



TABLE



XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



, select



XPath , . MyItem



, Name



NAME , . , :

<xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



, select



XPath- , . , xsl:value-of



, xsl:for-each



. , xsl:for-each



, , xsl:value-of



– (.. xsl:for-each



).

, , .

, asx, sap, prg



(XSLT ). XML, xsl:transform



:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







.. , exclude-result-prefixes



, XML.

, RF_CHILD_LIST



. . – .

, id . ChilListID



. .

:

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







.. OutChilds



ChilListID



. , XML-, /asx:abap/asx:heap



.



? item prg:T_DEEP_STRUCT



id ChilListID



. xsl:for-each



.

prg:T_DEEP_STRUCT



id ChilListID



:

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





XPath , prg:T_DEEP_STRUCT



, id



ChilListID



.

item: <xsl:for-each select="item">







, , , , XSLT . :

<xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







MyItem



Name



. :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







. : .

xsl:apply-templates



, select



XML .

, , ChilListID



. , , RF_CHILD_LIST



href,



#id___



. .. href



, . XPath : substring(RF_CHILD_LIST/@href,2)



. .. :

<xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







, :

<xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







, , , .



, : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











, XSLT ?





ABAP MSDN: XSLT XPath tutorial XSLT








  1. , . . .. RF_CHILD_LIST



    , DATA ( TYPE REF TO DATA



    ), , href



    , .

    , <RF_CHILD_LIST href="#d1" />



    , #



    -
    XLink , d1



    – . XML-: asx:heap



    , id



    d1. < prg:T_DEEP_STRUCT id="d1" … >



    . , .

    .., XML , .



    XSLT- ?

    XSLT-.

    SAP STRANS.



    , «»(F5).



    – , ( – XSLT). Enter.



    XSLT, . , , – .



    , .., , ( , , , html ).



    , , .. .

    <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="/"> </xsl:template> </xsl:transform>







    :

    xmlns:xsl



    , xsl. .. , xsl



    : ( <xsl:strip-space elements="*"/>



    ) xmlns:sap



    , sap xsl:transform



    , XSLT- <xsl:strip-space elements="*"/>



    <xsl:template match="/">



    , XML



    XSLT- ( xsl:template



    ) XML-, match



    . match



    XPath . , «/», XML- TABLE



    "/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



    ) ( TABLE



    )).



    , XML- List. :

    <xsl:template match="/"> <List> </List> </xsl:template>







    item



    TABLE



    XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



    , select



    XPath , . MyItem



    , Name



    NAME , . , :

    <xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



    , select



    XPath- , . , xsl:value-of



    , xsl:for-each



    . , xsl:for-each



    , , xsl:value-of



    – (.. xsl:for-each



    ).

    , , .

    , asx, sap, prg



    (XSLT ). XML, xsl:transform



    :

    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







    .. , exclude-result-prefixes



    , XML.

    , RF_CHILD_LIST



    . . – .

    , id . ChilListID



    . .

    :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







    .. OutChilds



    ChilListID



    . , XML-, /asx:abap/asx:heap



    .



    ? item prg:T_DEEP_STRUCT



    id ChilListID



    . xsl:for-each



    .

    prg:T_DEEP_STRUCT



    id ChilListID



    :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





    XPath , prg:T_DEEP_STRUCT



    , id



    ChilListID



    .

    item: <xsl:for-each select="item">







    , , , , XSLT . :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







    MyItem



    Name



    . :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







    . : .

    xsl:apply-templates



    , select



    XML .

    , , ChilListID



    . , , RF_CHILD_LIST



    href,



    #id___



    . .. href



    , . XPath : substring(RF_CHILD_LIST/@href,2)



    . .. :

    <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







    , :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







    , , , .



    , : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









    ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











    , XSLT ?





    ABAP MSDN: XSLT XPath tutorial XSLT








  2. , . . .. RF_CHILD_LIST



    , DATA ( TYPE REF TO DATA



    ), , href



    , .

    , <RF_CHILD_LIST href="#d1" />



    , #



    -
    XLink , d1



    – . XML-: asx:heap



    , id



    d1. < prg:T_DEEP_STRUCT id="d1" … >



    . , .

    .., XML , .



    XSLT- ?

    XSLT-.

    SAP STRANS.



    , «»(F5).



    – , ( – XSLT). Enter.



    XSLT, . , , – .



    , .., , ( , , , html ).



    , , .. .

    <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="/"> </xsl:template> </xsl:transform>







    :

    xmlns:xsl



    , xsl. .. , xsl



    : ( <xsl:strip-space elements="*"/>



    ) xmlns:sap



    , sap xsl:transform



    , XSLT- <xsl:strip-space elements="*"/>



    <xsl:template match="/">



    , XML



    XSLT- ( xsl:template



    ) XML-, match



    . match



    XPath . , «/», XML- TABLE



    "/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



    ) ( TABLE



    )).



    , XML- List. :

    <xsl:template match="/"> <List> </List> </xsl:template>







    item



    TABLE



    XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



    , select



    XPath , . MyItem



    , Name



    NAME , . , :

    <xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



    , select



    XPath- , . , xsl:value-of



    , xsl:for-each



    . , xsl:for-each



    , , xsl:value-of



    – (.. xsl:for-each



    ).

    , , .

    , asx, sap, prg



    (XSLT ). XML, xsl:transform



    :

    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







    .. , exclude-result-prefixes



    , XML.

    , RF_CHILD_LIST



    . . – .

    , id . ChilListID



    . .

    :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







    .. OutChilds



    ChilListID



    . , XML-, /asx:abap/asx:heap



    .



    ? item prg:T_DEEP_STRUCT



    id ChilListID



    . xsl:for-each



    .

    prg:T_DEEP_STRUCT



    id ChilListID



    :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





    XPath , prg:T_DEEP_STRUCT



    , id



    ChilListID



    .

    item: <xsl:for-each select="item">







    , , , , XSLT . :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







    MyItem



    Name



    . :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







    . : .

    xsl:apply-templates



    , select



    XML .

    , , ChilListID



    . , , RF_CHILD_LIST



    href,



    #id___



    . .. href



    , . XPath : substring(RF_CHILD_LIST/@href,2)



    . .. :

    <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







    , :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







    , , , .



    , : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









    ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











    , XSLT ?





    ABAP MSDN: XSLT XPath tutorial XSLT








  3. , . . .. RF_CHILD_LIST



    , DATA ( TYPE REF TO DATA



    ), , href



    , .

    , <RF_CHILD_LIST href="#d1" />



    , #



    -
    XLink , d1



    – . XML-: asx:heap



    , id



    d1. < prg:T_DEEP_STRUCT id="d1" … >



    . , .

    .., XML , .



    XSLT- ?

    XSLT-.

    SAP STRANS.



    , «»(F5).



    – , ( – XSLT). Enter.



    XSLT, . , , – .



    , .., , ( , , , html ).



    , , .. .

    <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="/"> </xsl:template> </xsl:transform>







    :

    xmlns:xsl



    , xsl. .. , xsl



    : ( <xsl:strip-space elements="*"/>



    ) xmlns:sap



    , sap xsl:transform



    , XSLT- <xsl:strip-space elements="*"/>



    <xsl:template match="/">



    , XML



    XSLT- ( xsl:template



    ) XML-, match



    . match



    XPath . , «/», XML- TABLE



    "/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



    ) ( TABLE



    )).



    , XML- List. :

    <xsl:template match="/"> <List> </List> </xsl:template>







    item



    TABLE



    XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



    , select



    XPath , . MyItem



    , Name



    NAME , . , :

    <xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



    , select



    XPath- , . , xsl:value-of



    , xsl:for-each



    . , xsl:for-each



    , , xsl:value-of



    – (.. xsl:for-each



    ).

    , , .

    , asx, sap, prg



    (XSLT ). XML, xsl:transform



    :

    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







    .. , exclude-result-prefixes



    , XML.

    , RF_CHILD_LIST



    . . – .

    , id . ChilListID



    . .

    :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







    .. OutChilds



    ChilListID



    . , XML-, /asx:abap/asx:heap



    .



    ? item prg:T_DEEP_STRUCT



    id ChilListID



    . xsl:for-each



    .

    prg:T_DEEP_STRUCT



    id ChilListID



    :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





    XPath , prg:T_DEEP_STRUCT



    , id



    ChilListID



    .

    item: <xsl:for-each select="item">







    , , , , XSLT . :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







    MyItem



    Name



    . :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







    . : .

    xsl:apply-templates



    , select



    XML .

    , , ChilListID



    . , , RF_CHILD_LIST



    href,



    #id___



    . .. href



    , . XPath : substring(RF_CHILD_LIST/@href,2)



    . .. :

    <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







    , :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







    , , , .



    , : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









    ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











    , XSLT ?





    ABAP MSDN: XSLT XPath tutorial XSLT








  4. , . . .. RF_CHILD_LIST



    , DATA ( TYPE REF TO DATA



    ), , href



    , .

    , <RF_CHILD_LIST href="#d1" />



    , #



    -
    XLink , d1



    – . XML-: asx:heap



    , id



    d1. < prg:T_DEEP_STRUCT id="d1" … >



    . , .

    .., XML , .



    XSLT- ?

    XSLT-.

    SAP STRANS.



    , «»(F5).



    – , ( – XSLT). Enter.



    XSLT, . , , – .



    , .., , ( , , , html ).



    , , .. .

    <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="/"> </xsl:template> </xsl:transform>







    :

    xmlns:xsl



    , xsl. .. , xsl



    : ( <xsl:strip-space elements="*"/>



    ) xmlns:sap



    , sap xsl:transform



    , XSLT- <xsl:strip-space elements="*"/>



    <xsl:template match="/">



    , XML



    XSLT- ( xsl:template



    ) XML-, match



    . match



    XPath . , «/», XML- TABLE



    "/asx:abap/asx:values/TABLE" (.. XML- ( asx:abap



    ) ( TABLE



    )).



    , XML- List. :

    <xsl:template match="/"> <List> </List> </xsl:template>







    item



    TABLE



    XML , <xsl:for-each select="/asx:abap/asx:values/TABLE/item">



    , select



    XPath , . MyItem



    , Name



    NAME , . , :

    <xsl:template match="/"> <List> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </List> </xsl:template>







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



    , select



    XPath- , . , xsl:value-of



    , xsl:for-each



    . , xsl:for-each



    , , xsl:value-of



    – (.. xsl:for-each



    ).

    , , .

    , asx, sap, prg



    (XSLT ). XML, xsl:transform



    :

    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0">







    .. , exclude-result-prefixes



    , XML.

    , RF_CHILD_LIST



    . . – .

    , id . ChilListID



    . .

    :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> </xsl:template>







    .. OutChilds



    ChilListID



    . , XML-, /asx:abap/asx:heap



    .



    ? item prg:T_DEEP_STRUCT



    id ChilListID



    . xsl:for-each



    .

    prg:T_DEEP_STRUCT



    id ChilListID



    :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]">





    XPath , prg:T_DEEP_STRUCT



    , id



    ChilListID



    .

    item: <xsl:for-each select="item">







    , , , , XSLT . :

    <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item">







    MyItem



    Name



    . :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> </xsl:for-each> </xsl:template>







    . : .

    xsl:apply-templates



    , select



    XML .

    , , ChilListID



    . , , RF_CHILD_LIST



    href,



    #id___



    . .. href



    , . XPath : substring(RF_CHILD_LIST/@href,2)



    . .. :

    <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates>







    , :

    <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <xsl:param name="ChilListID"/> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template>







    , , , .



    , : <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" xmlns:prg="http://www.sap.com/abapxml/types/program/ZEDU_TEST_XSLT_DEEP_TRANSFORM" exclude-result-prefixes="asx sap prg" version="1.0"> <xsl:strip-space elements="*"/> <!-- , . --> <xsl:template match="/"> <List> <!-- XML --> <xsl:for-each select="/asx:abap/asx:values/TABLE/item"> <MyItem> <!-- NAMR --> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- , --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </List> </xsl:template> <!-- --> <xsl:template match="/asx:abap/asx:heap" name="OutChilds"> <!-- --> <xsl:param name="ChilListID"/> <!-- , id , --> <xsl:for-each select="prg:T_DEEP_STRUCT[@id=$ChilListID]/item"> <MyItem> <Name><xsl:value-of select="NAME"/></Name> </MyItem> <!-- --> <xsl:apply-templates select="/asx:abap/asx:heap"> <xsl:with-param name="ChilListID" select="substring(RF_CHILD_LIST/@href,2)"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> </xsl:transform>









    ABAP- REPORT zedu_test_xslt_deep_transform. * " " TYPES : BEGIN OF tdeep_struct , name TYPE string , rf_child_list TYPE REF TO data , END OF tdeep_struct * " " , t_deep_struct TYPE STANDARD TABLE OF tdeep_struct WITH NON-UNIQUE DEFAULT KEY . DATA : gt_tree TYPE t_deep_struct " , gtree TYPE tdeep_struct " , gchild TYPE tdeep_struct " , ggrandchild TYPE tdeep_struct " , gxml_str TYPE string " XML , go_xml_doc TYPE REF TO cl_xml_document " XML . FIELD-SYMBOLS : <gt_child_list> TYPE t_deep_struct " , <gt_grandchild_list> TYPE t_deep_struct " . START-OF-SELECTION. * gtree-name = 'GrandParent1'. CREATE DATA gtree-rf_child_list TYPE t_deep_struct. ASSIGN gtree-rf_child_list->* TO <gt_child_list>. gchild-name = 'Child1'. APPEND gchild TO <gt_child_list>. gchild-name = 'Child2'. CREATE DATA gchild-rf_child_list TYPE t_deep_struct. ASSIGN gchild-rf_child_list->* TO <gt_grandchild_list>. ggrandchild-name = 'GrandChild1'. APPEND ggrandchild TO <gt_grandchild_list>. APPEND gchild TO <gt_child_list>. APPEND gtree TO gt_tree. CLEAR gtree. gtree-name = 'GrandParent2'. APPEND gtree TO gt_tree. * XSLT- CALL TRANSFORMATION zedu_test_xslt_deep_transform2 SOURCE table = gt_tree RESULT XML gxml_str. * XML CREATE OBJECT go_xml_doc. go_xml_doc->parse_string( gxml_str ). go_xml_doc->display( ).











    , XSLT ?





    ABAP MSDN: XSLT XPath tutorial XSLT











All Articles