<PQWorklist>
<userID>DT77214</userID>
<password>&&&&&&</password>
<hostAddress>%%%%%%</hostAddress>
<hostPort>&&&&&%%%%%</hostPort>
<DST>
<PQWorklist>
<transaction id="2012-07-30-16.38.49.403260T01" children="N" hasParent="Y">
<permission>Update</permission>
<id>2012-07-30-16.38.49.403260T01</id>
<createTime time="Y">2012-07-30T16:38:49:403260-05:00</createTime>
<businessArea>CSMHCDV</businessArea>
<type>ISSUE</type>
<CFLG>2</CFLG>
<TEAM>CATCHALL</TEAM>
<WSL7/>
<commentsExist>Y</commentsExist>
<iconName/>
<status>CATCHALL</status>
<queue>CATCHALL</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<suspended>N</suspended>
<amountType/>
<amount>0.0000</amount>
<assignedTo>DT77214</assignedTo>
<lockedBy>DT77214</lockedBy>
<process>Y</process>
<workStep status="CATCHALL">Issue Status Queue</workStep>
<customScreen>WRKXMPL</customScreen>
<externalSystem>
<host/>
<executable/>
<parameters/>
<procedure/>
</externalSystem>
<PEND>CATCHALL</PEND>
<RULE>99</RULE>
<ICT1>PCP Change</ICT1>
<ITYP>Change Requests</ITYP>
<MLOB>HMO</MLOB>
<OUID>DT64253</OUID>
<RCAL>CREATED</RCAL>
<RGRP>COMM*H</RGRP>
<RMEM>10021*01</RMEM>
<RPRV>PCP4</RPRV>
<RTYP>PCP</RTYP>
<SBJT>Member</SBJT>
<STPT>2012-07-30-16.38.46.000000</STPT>
<STRT>2012-07-30-16.38.20.000000</STRT>
<UIID>20120730-163846-DT64253</UIID>
</transaction>
<transaction id="2012-09-01-07.35.56.311400T01" children="N" hasParent="Y">
<permission>Update</permission>
<id>2012-09-01-07.35.56.311400T01</id>
<createTime time="Y">2012-09-01T07:35:56:311400-05:00</createTime>
<businessArea>CSMHCQA</businessArea>
<type>ISSUE</type>
<CFLG>2</CFLG>
<TEAM>CATCHALL</TEAM>
<WSL7/>
<commentsExist>Y</commentsExist>
<iconName/>
<status>CATCHALL</status>
<queue>CATCHALL</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<suspended>N</suspended>
<amountType/>
<amount>0.0000</amount>
<assignedTo>DT77214</assignedTo>
<lockedBy/>
<process>Y</process>
<workStep status="CATCHALL">Issue Status Queue</workStep>
<customScreen>WRKXMPL</customScreen>
<externalSystem>
<host/>
<executable/>
<parameters/>
<procedure/>
</externalSystem>
<PEND>CATCHALL</PEND>
<RULE>99</RULE>
<ICT1>PROVIDER PROSPECTUS</ICT1>
<ICT2>MEMBER PROSPECTUS</ICT2>
<ITYP>REQUEST</ITYP>
<OUID>DT64642</OUID>
<RCAL>CREATED</RCAL>
<SBJT>Unknown</SBJT>
<STPT>2012-09-01-08.32.21.000000</STPT>
<STRT>2012-09-01-07.56.52.000000</STRT>
<UIID>20120901-083221-DT64642</UIID>
</transaction>
</PQWorklist>
</DST>
</PQWorklist>
上面的XML是我需要使用xsl表转换成下面的XML可以对此有任何帮助......
在上面的XML中,我们需要删除重复的标记,这样我才能得到我期望的结果......
请帮帮我...
<PQWorklist>
<userID>DT77214</userID>
<password>&&&&&&</password>
<hostAddress>%%%%%%</hostAddress>
<hostPort>&&&&&%%%%%</hostPort>
<transaction id="2012-07-30-16.38.49.403260T01" children="N" hasParent="Y">
<permission>Update</permission>
<id>2012-07-30-16.38.49.403260T01</id>
<createTime time="Y">2012-07-30T16:38:49:403260-05:00</createTime>
<businessArea>CSMHCDV</businessArea>
<type>ISSUE</type>
<CFLG>2</CFLG>
<TEAM>CATCHALL</TEAM>
<WSL7/>
<commentsExist>Y</commentsExist>
<iconName/>
<status>CATCHALL</status>
<queue>CATCHALL</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<suspended>N</suspended>
<amountType/>
<amount>0.0000</amount>
<assignedTo>DT77214</assignedTo>
<lockedBy>DT77214</lockedBy>
<process>Y</process>
<workStep status="CATCHALL">Issue Status Queue</workStep>
<customScreen>WRKXMPL</customScreen>
<externalSystem>
<host/>
<executable/>
<parameters/>
<procedure/>
</externalSystem>
<PEND>CATCHALL</PEND>
<RULE>99</RULE>
<ICT1>PCP Change</ICT1>
<ITYP>Change Requests</ITYP>
<MLOB>HMO</MLOB>
<OUID>DT64253</OUID>
<RCAL>CREATED</RCAL>
<RGRP>COMM*H</RGRP>
<RMEM>10021*01</RMEM>
<RPRV>PCP4</RPRV>
<RTYP>PCP</RTYP>
<SBJT>Member</SBJT>
<STPT>2012-07-30-16.38.46.000000</STPT>
<STRT>2012-07-30-16.38.20.000000</STRT>
<UIID>20120730-163846-DT64253</UIID>
</transaction>
<transaction id="2012-09-01-07.35.56.311400T01" children="N" hasParent="Y">
<permission>Update</permission>
<id>2012-09-01-07.35.56.311400T01</id>
<createTime time="Y">2012-09-01T07:35:56:311400-05:00</createTime>
<businessArea>CSMHCQA</businessArea>
<type>ISSUE</type>
<CFLG>2</CFLG>
<TEAM>CATCHALL</TEAM>
<WSL7/>
<commentsExist>Y</commentsExist>
<iconName/>
<status>CATCHALL</status>
<queue>CATCHALL</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<suspended>N</suspended>
<amountType/>
<amount>0.0000</amount>
<assignedTo>DT77214</assignedTo>
<lockedBy/>
<process>Y</process>
<workStep status="CATCHALL">Issue Status Queue</workStep>
<customScreen>WRKXMPL</customScreen>
<externalSystem>
<host/>
<executable/>
<parameters/>
<procedure/>
</externalSystem>
<PEND>CATCHALL</PEND>
<RULE>99</RULE>
<ICT1>PROVIDER PROSPECTUS</ICT1>
<ICT2>MEMBER PROSPECTUS</ICT2>
<ITYP>REQUEST</ITYP>
<OUID>DT64642</OUID>
<RCAL>CREATED</RCAL>
<SBJT>Unknown</SBJT>
<STPT>2012-09-01-08.32.21.000000</STPT>
<STRT>2012-09-01-07.56.52.000000</STRT>
<UIID>20120901-083221-DT64642</UIID>
</transaction>
</PQWorklist>
答案 0 :(得分:1)
请尝试以下样式表:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<PQWorklist>
<xsl:copy-of select="PQ/PQWorklist/hostAddress"/>
<xsl:copy-of select="PQ/PQWorklist/hostPort"/>
<xsl:copy-of select="PQ/PQWorklist/userID"/>
<xsl:copy-of select="PQ/PQWorklist/password"/>
<xsl:copy-of select="descendant::transaction"/>
</PQWorklist>
</xsl:template>
</xsl:stylesheet>