Преобразование Их Xml В Xml. Функция Copy-of

jager

New member
10.10.2014
1
0
#1
Есть xml документ

<EagleML eaglemlVersion="2-0" actualBuild="1" eaglemlType="ReferenceTransactionMessage" xmlns="http://www.eagleinvsys.com/2011/EagleML-2-0">
<header>
<batchIdentifier>
<batchId>ADX_A.20121214</batchId>
<sequenceNumber>44</sequenceNumber>
<totalCount>44</totalCount>
</batchIdentifier>
<sentBy>ALLSTATE</sentBy>
<creationTimestamp>2012-12-14T22:33:50.816-06:00</creationTimestamp>
</header>
<validation validationScheme="Allstate" xmlns="http://www.eagleinvsys.com/2011/EagleML-2-0">Allstate</validation>
<party id="Allstate" xmlns="http://www.eagleinvsys.com/2011/EagleML-2-0">
<partyId>Allstate</partyId>
<partyName>Allstate Investments</partyName>
</party>
<referenceTransaction>
<header>
<identifier id="Allstate">
<transactionId transactionIdScheme="Allstate">Allstate</transactionId>
</identifier>
</header>
<rating>
<sourceName>ALADDIN</sourceName>
<updateSource>ALDDNGAL</updateSource>
<effectiveDate>2012-12-14</effectiveDate>
<ratingDataModel>
<alphaRating>2</alphaRating>
<submittedBy>l5mbeatt</submittedBy>
<submittedDate>2012-12-14T15:57:29-06:00</submittedDate>
<ratingCode>RV_2</ratingCode>
<ratingTypeIndicator/>
<ratingChar1>RV_2</ratingChar1>
</ratingDataModel>
</rating>
</referenceTransaction>
<referenceTransaction>
<header>
<identifier id="Allstate">
<transactionId transactionIdScheme="Allstate">Allstate</transactionId>
</identifier>
</header>
<rating>
<sourceName>ALADDIN</sourceName>
<updateSource>ALDDNGAL</updateSource>
<effectiveDate>2012-12-14</effectiveDate>
<ratingDataModel>
<alphaRating>45</alphaRating>
<submittedBy>l5mbeatt</submittedBy>
<submittedDate>2012-12-14T15:57:29-06:00</submittedDate>
<ratingCode>TH_45</ratingCode>
<ratingTypeIndicator/>
<ratingChar1>TH_45</ratingChar1>
</ratingDataModel>
</rating>
</referenceTransaction>
<referenceTransaction>
<header>
<identifier id="Allstate">
<transactionId transactionIdScheme="Allstate">Allstate</transactionId>
</identifier>
</header>
<rating>
<sourceName>ALADDIN</sourceName>
<updateSource>ALDDNGAL</updateSource>
<effectiveDate>2012-12-14</effectiveDate>
<ratingDataModel>
<alphaRating>CONCERN</alphaRating>
<submittedBy>l5bprice</submittedBy>
<submittedDate>2012-12-14T15:43:59-06:00</submittedDate>
<ratingCode>WL_CONCERN</ratingCode>
<ratingTypeIndicator>WATCHLIST</ratingTypeIndicator>
<ratingChar1>WL_CONCERN</ratingChar1>
<ratingDate1>2012-12-14</ratingDate1>
</ratingDataModel>
</rating>
</referenceTransaction>
<referenceTransaction>
<header>
<identifier id="Allstate">
<transactionId transactionIdScheme="Allstate">Allstate</transactionId>
</identifier>
</header>
<rating>
<sourceName>ALADDIN</sourceName>
<updateSource>ALDDNGAL</updateSource>
<effectiveDate></effectiveDate>
<ratingDataModel>
<alphaRating>CONCERN</alphaRating>
<submittedBy>nfallon</submittedBy>
<submittedDate>2012-12-14T16:05:25-06:00</submittedDate>
<ratingCode>WL_CONCERN</ratingCode>
<ratingTypeIndicator>WATCHLIST</ratingTypeIndicator>
<ratingChar1>WL_CONCERN</ratingChar1>
<ratingDate1>2012-12-14</ratingDate1>
</ratingDataModel>
</rating>
</referenceTransaction>
</EagleML>

Нужно отфильтровать узлы <referenceTransaction> - оставить только те, где узел <effectiveDate> заполнен. Составил выражение на XPath для выборки этих узлов, в XMLPad встроенный xpath вычислитель нужное находит, а вот xsl:copy-of отказывается копировать, на выходе пустой документ. В чём собсно борода?


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" indent="yes"/>

<xsl:template match="/">
<xsl:copy-of select="//EagleML/referenceTransaction[rating/effectiveDate != '']"/>
</xsl:template>


</xsl:stylesheet>