나는 XML 아래에 있고 나는 다음과 같이 서브 노드가 최상위 노드로 언급 한 입력 XML에 XSLTXSLT는
를 사용하여 XML을 다음으로 변환해야합니다 :
<?xml version="1.0"?>
<referenced>
<name>PocTree/PocTree.services:getReferencesForServices</name>
<LOCK_STATUS>3</LOCK_STATUS>
<type>
<svc_type>flow</svc_type>
<svc_subtype>default</svc_subtype>
</type>
<path/>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>reference</status>
<reference>
<name>WmRoot/wm.server.ns.dependency:getReferenced</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<svc_type>java</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;0</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>WmPublic/pub.xml:documentToXMLString</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<svc_type>java</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;1</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>PocTree/PocTree.services:jkl</name>
<LOCK_STATUS>3</LOCK_STATUS>
<type>
<svc_type>xsltservice</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;2</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>WmPublic/pub.xml:xmlStringToXMLNode</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<svc_type>java</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;3</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>WmPublic/pub.xml:xmlNodeToDocument</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<svc_type>java</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;4</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>PocTree/PocTree.services:ghi</name>
<LOCK_STATUS>4</LOCK_STATUS>
<type>
<svc_type>xsltservice</svc_type>
<svc_subtype>unknown</svc_subtype>
</type>
<path>/Flow Path;1.0/INVOKE;5</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<reference>
<name>WxPackageTree/WxPackageTree.doc:NodeInfo</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<type_name>record</type_name>
</type>
<path>/Service Path;1.0/signature;2;subPath;"/nodes;4;0;WxPackageTree.doc:NodeInfo"</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>reference</status>
<reference>
<name>WxPackageTree/WxPackageTree.doc:NodeInfo</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>
<type_name>record</type_name>
</type>
<path>/children;4;1;WxPackageTree.doc:NodeInfo</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>recursive</status>
</reference>
<reference>
<name>PocTree/PocTree.docs:nodeInfo</name>
<LOCK_STATUS>4</LOCK_STATUS>
<type>
<type_name>record</type_name>
</type>
<path>/Flow Path;1.0/MAP;6/MAPCOPY;1/to_field;-2;subPath;"/nodeInfo;4;0;PocTree.docs:nodeInfo"</path>
<path>/Flow Path;1.0/MAP;6/MAPCOPY;2/to_field;-2;subPath;"/nodeInfo;4;0;PocTree.docs:nodeInfo"</path>
<path>/Flow Path;1.0/MAP;6/MAPCOPY;3/to_field;-2;subPath;"/nodeInfo;4;0;PocTree.docs:nodeInfo"</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>reference</status>
<reference>
<name>PocTree/PocTree.docs:nodeInfo</name>
<LOCK_STATUS>4</LOCK_STATUS>
<type>
<type_name>record</type_name>
</type>
<path>/children;4;1;PocTree.docs:nodeInfo</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>recursive</status>
</reference>
</reference>
</reference>
</referenced>
예상 출력 XML 구조 같은 것을해야한다 :
<?xml version="1.0"?>
<nodeInfo>
<name>PocTree/PocTree.services:getReferencesForServices</name>
<LOCK_STATUS>3</LOCK_STATUS>
<type>flow</type>
<path/>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>reference</status>
<children>
<name>WmRoot/wm.server.ns.dependency:getReferenced</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>java</type>
<path>/Flow Path;1.0/INVOKE;0</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</children>
<children>
<name>WmPublic/pub.xml:documentToXMLString</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>java</type>
<path>/Flow Path;1.0/INVOKE;1</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</reference>
<children>
<name>PocTree/PocTree.services:jkl</name>
<LOCK_STATUS>3</LOCK_STATUS>
<type>xsltservice</type>
<path>/Flow Path;1.0/INVOKE;2</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</children>
<children>
<name>WmPublic/pub.xml:xmlStringToXMLNode</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>java</type>
<path>/Flow Path;1.0/INVOKE;3</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</children>
<children>
<name>WmPublic/pub.xml:xmlNodeToDocument</name>
<LOCK_STATUS>2</LOCK_STATUS>
<type>java</type>
<path>/Flow Path;1.0/INVOKE;4</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</children>
<children>
<name>PocTree/PocTree.services:ghi</name>
<LOCK_STATUS>4</LOCK_STATUS>
<type>xsltservice</type>
<path>/Flow Path;1.0/INVOKE;5</path>
<isPub>false</isPub>
<isNotification>false</isNotification>
<isFlowServiceDisabled>false</isFlowServiceDisabled>
<status>resolved</status>
</children>
</nodeInfo>
그러나 예상 출력 XML을받을 수있는 기준은 그 오의 가치에서이다 언젠가 별도의 태그를 가지고이 부분
<type>
<svc_type>flow</svc_type>
<svc_subtype>default</svc_subtype>
</type>
에게 있습니다 입력 XML의 하위 노드의 NE이 의미는, 자식 노드 또는 단지 하나를 가질 수있다.
<type>
<type_name>record</type_name>
</type>
이제 예상 출력 XML은 <svc_type>
는 '흐름'또는 '자바 서비스'또는 'xsltservice'의 값을 갖는 경우 입력 XML에서 만 <refrence>
태그를 선택하고 <type_name>
을 가지고 그 <refrence>
태그를 생략하는 등의 방법으로 설계되어야한다 모든 값이있는 <type>
상위 노드에 속합니다.
<svc_type>
의 콘텐츠는 하위 노드는 부모 노드 용
<type>
<svc_type>
및
<svc_subtype>
없어야
<type>
출력 XML의 값에 맵핑한다.
이 주제에 대한 도움을주십시오. 입력 XML 필터링을 달성하기 위해 작성된 XSLT 포함
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="referenced">
<nodeInfo>
<xsl:apply-templates />
</nodeInfo>
</xsl:template>
<xsl:template match="(reference[type/svc_type[contains(., 'flow') or contains(., 'java') or contains(., 'xsltservice')]]) and (reference[type/type_name[not(contains(.,'record'))]])">
<children>
<xsl:apply-templates />
</children>
</xsl:template>
</xsl:stylesheet>
그래도이 부분은 커버하지 않는 XSLT 위 - <svc_type>
이 하위 노드 <svc_type>
및 <svc_subtype>
없어야 <type>
및 XML 출력 값에 매핑되어야한다 상위 노드의 경우 <type>
.
지금까지 어떤 시도를하셨습니까? 코드 게시! 네가 그것을 달렸을 때 무슨 일이 일어난거야? 대신에 당신은 무엇을 기대 했습니까? 특별히 문제가있는 것은 무엇입니까? https://stackoverflow.com/help/mcve – Robert
@ 로버트 - 질문 끝 부분에 xslt 부분을 추가했습니다. 좀 봐 주시겠습니까? 출력에 대해서는 부모 노드에 속한 태그가있는 모든 값을 더하거나 필터링 할 수 없습니다. 은 값에 매핑해야하고 출력 XML에는 하위 노드 을 포함하면 안됩니다. 부모 노드의 경우 –
Nis