0
入力は企業の組織です。 XMLの構造、複数の部門とそこにサブ部門があります。組織内のサブ部門のレベル。構造はタグLEVELで与えられます。XSLT:再帰的ノードを持つレベルからXMLへのXMLリスト
出力は、複数の部署を持つXMLでもかまいません。しかし、現在、サブ部門は再帰的なノードになければなりません。 DepartmentListとSubDepartmentListはどちらも1つ以上のDepartment(または0)で構成され、DepartmentにはDetailsの下にSubDepartmentListがあります。
私が使用しているツールはXSLT 1.0しか知らないので、このバージョンでは解決できると思っています。入力の
例(のみ1つの部門):
<?xml version="1.0" encoding="UTF-8"?>
<Z_HR_HRM_SYNC_DEPARTMENTS>
<IT_ORG>
<item>
<ORGEH>50013998</ORGEH>
<ORGEH_PARENT>50000025</ORGEH_PARENT>
<TITLE>Title 50013998</TITLE>
<SUB_DEP>
<item>
<LEVEL>1</LEVEL>
<ORGEH>50014000</ORGEH>
<ORGEH_PARENT>50013998</ORGEH_PARENT>
<TITLE>Title 50014000</TITLE>
</item>
<item>
<LEVEL>1</LEVEL>
<ORGEH>50000849</ORGEH>
<ORGEH_PARENT>50013998</ORGEH_PARENT>
<TITLE>Title 50000849</TITLE>
</item>
<item>
<LEVEL>2</LEVEL>
<ORGEH>50017825</ORGEH>
<ORGEH_PARENT>50000849</ORGEH_PARENT>
<TITLE>Title 50017825</TITLE>
</item>
<item>
<LEVEL>2</LEVEL>
<ORGEH>50001684</ORGEH>
<ORGEH_PARENT>50000849</ORGEH_PARENT>
<TITLE>Title 50001684</TITLE>
</item>
<item>
<LEVEL>2</LEVEL>
<ORGEH>50012716</ORGEH>
<ORGEH_PARENT>50000849</ORGEH_PARENT>
<TITLE>Title 50012716</TITLE>
</item>
<item>
<LEVEL>3</LEVEL>
<ORGEH>50001709</ORGEH>
<ORGEH_PARENT>50012716</ORGEH_PARENT>
<TITLE>Title 50001709</TITLE>
</item>
<item>
<LEVEL>2</LEVEL>
<ORGEH>50012713</ORGEH>
<ORGEH_PARENT>50000849</ORGEH_PARENT>
<TITLE>Title 50012713</TITLE>
</item>
<item>
<LEVEL>2</LEVEL>
<ORGEH>50001694</ORGEH>
<ORGEH_PARENT>50000849</ORGEH_PARENT>
<TITLE>Title 50001694</TITLE>
</item>
<item>
<LEVEL>3</LEVEL>
<ORGEH>50010284</ORGEH>
<ORGEH_PARENT>50001694</ORGEH_PARENT>
<TITLE>Title 50010284</TITLE>
</item>
<item>
<LEVEL>3</LEVEL>
<ORGEH>50001695</ORGEH>
<ORGEH_PARENT>50001694</ORGEH_PARENT>
<TITLE>Title 50001695</TITLE>
</item>
<item>
<LEVEL>4</LEVEL>
<ORGEH>50001697</ORGEH>
<ORGEH_PARENT>50001695</ORGEH_PARENT>
<TITLE>Title 50001697</TITLE>
</item>
</SUB_DEP>
</item>
</IT_ORG>
</Z_HR_HRM_SYNC_DEPARTMENTS>
手によって作られた対応する出力:私は今、XSLTに新しい終了していますし、単純なものを解決してきたが、
<?xml version="1.0" encoding="UTF-8"?>
<ns1:BatchSyncDepartments xmlns:ns1="http://schemas.hr-manager.net/remoting/1.0/">
<ns1:request>
<ns1:DepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50013998</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000025</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50013998</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50014000</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50013998</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50014000</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50013998</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50000849</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50017825</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50017825</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50001684</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50001684</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50012716</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50012716</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50001709</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50012716</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50001709</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50012713</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50012713</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50001694</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50000849</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50001694</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50010284</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50001694</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50010284</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50001695</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50001694</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50001695</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>50001697</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>50001695</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>Title 50001697</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList/>
</ns1:Details>
</ns1:Department>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
</ns1:DepartmentList>
</ns1:request>
</ns1:BatchSyncDepartments>
私は立ち往生しています:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:template match="Z_HR_HRM_SYNC_DEPARTMENTS">
<ns1:BatchSyncDepartments xmlns:ns1="http://schemas.hr-manager.net/remoting/1.0/">
<ns1:request>
<ns1:DepartmentList>
<xsl:for-each select="IT_ORG/item">
<ns1:Department>
<ns1:Id>
<ns1:ThirdPartyId>
<xsl:value-of select="ORGEH"/>
</ns1:ThirdPartyId>
</ns1:Id>
<ns1:ParentDepartmentId>
<ns1:ThirdPartyId>
<xsl:value-of select="ORGEH_PARENT"/>
</ns1:ThirdPartyId>
</ns1:ParentDepartmentId>
<ns1:Title>
<xsl:value-of select="TITLE"/>
</ns1:Title>
<ns1:Details>
<ns1:SubDepartmentList>
</ns1:SubDepartmentList>
</ns1:Details>
</ns1:Department>
</xsl:for-each>
</ns1:DepartmentList>
</ns1:request>
</ns1:BatchSyncDepartments>
</xsl:template>
</xsl:stylesheet>
誰かが何らかの入力を手伝って進めてくれることを願っています。
おかげで多くのことを。完璧に動作します。私はそれが短く素敵な方法でやり遂げられることを望んだが、限られた経験では不可能だった。経験豊かな人が助けてくれるのは、いつも素晴らしいことです。 – Gitte