[xsl] Re: [XSL-List: The Open Forum on XSL] Digest for 2017-06-20

Subject: [xsl] Re: [XSL-List: The Open Forum on XSL] Digest for 2017-06-20
From: "Rahul Singh rahulsinghindia15@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Jun 2017 09:07:02 -0000
Thanks

On Wed, Jun 21, 2017 at 2:50 PM, XSL-List: The Open Forum on XSL <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> This message contains the recent posts to the XSL-List: The Open Forum on
> XSL
> mailing list managed by Mulberry Technologies, Inc. (
> http://lists.mulberrytech.com).
>
>
>
> ---------- Forwarded message ----------
> From: Rahul Singh <rahulsinghindia15@xxxxxxxxx>
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc:
> Bcc:
> Date: Tue, 20 Jun 2017 18:59:40 +0530
> Subject: XSL Condition is not working
> My xsl code is not working as per given expected output. I need data from
> merge1.xml if Alert_Type__c='Document Downloaded' and
> Document_Name__c='abcTest.txt' is match with merge2.xml with
> Document_Name__c='abcTest.txt' and Alert_Type__c!='Document Downloaded'
>
> Input
> Merge1.xml:
>
>      <?xml version="1.0" encoding="UTF-8"?>
>      <objects>
>      <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>      <Document_Name__c>b (2).txt</Document_Name__c>
>      </Alert__c>
>      <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>       <Document_Name__c>w.txt</Document_Name__c>
>       </Alert__c>
>       <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>      <Document_Name__c>w.txt</Document_Name__c>
>      </Alert__c>
>      <Alert__c>
>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>      <Document_Name__c>file 1.pdf</Document_Name__c>
>      </Alert__c>
>      <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>      <Document_Name__c>abcTest.txt</Document_Name__c>
>      </Alert__c>
>      <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>       <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>      </Alert__c>
>      <Alert__c>
>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>      <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>       </Alert__c>
>       </objects>
>
> Merge2.xml:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <objects>
>     <Data__c>
>     <Document_Name__c>abcTest.txt</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>      </Data__c>
>     <Data__c>
>     <Document_Name__c>w.txt</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>     </Data__c>
>     <Data__c>
>     <Document_Name__c>q.txt</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>      </Data__c>
>      <Data__c>
>     <Document_Name__c>file 1.pdf</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>     </Data__c>
>     <Data__c>
>     <Document_Name__c>DealRoomData.csv</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>      </Data__c>
>     <Data__c>
>     <Document_Name__c>b (2).txt</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>     </Data__c>
>     <Data__c>
>     <Document_Name__c>w.txt</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>     </Data__c>
>     <Data__c>
>     <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>     </Data__c>
>     <Data__c>
>     <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>     <Alert_Type__c>Document Viewed</Alert_Type__c>
>      </Data__c>
>     </objects>
>
> XSL:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>     xmlns:xs="http://www.w3.org/2001/XMLSchema";
> exclude-result-prefixes="xs" version="2.0">
>     <xsl:output method="xml" indent="yes"/>
>     <xsl:param name="XMLMerge2" select="document('merge2.xml')"/>
>     <xsl:template match="objects">
>         <objects>
>             <xsl:if test="
>                     $XMLMerge2/objects != ''">
>                 <xsl:for-each select="Alert__c">
>                     <xsl:variable name="Email_from_merge1"
> select="Alert_Type__c"/>
>                     <xsl:variable name="Email_from_merge2"
> select="Document_Name__c"/>
>                     <xsl:if
>
test="not(exists($XMLMerge2/objects/Data__c[Alert_Type__c
> = $Email_from_merge1]))">
>                         <xsl:if
>                             test="exists($XMLMerge2/
> objects/Data__c[Document_Name__c = $Email_from_merge2])">
>                             <xsl:copy>
>                                 <xsl:apply-templates select="@* | node()"/>
>                             </xsl:copy>
>                         </xsl:if>
>                     </xsl:if>
>                 </xsl:for-each>
>             </xsl:if>
>         </objects>
>       </xsl:template>
>       <xsl:template match="@* | node()">
>         <xsl:copy>
>             <xsl:apply-templates select="@* | node()"/>
>         </xsl:copy>
>      </xsl:template>
>     </xsl:stylesheet>
>
> Expected  output:
>
>      <?xml version="1.0" encoding="UTF-8"?>
>      <objects>
>     <Alert__c>
>     <Alert_Type__c>Document Downloaded</Alert_Type__c>
>     <Document_Name__c>abcTest.txt</Document_Name__c>
>      </Alert__c>
>     </objects>
>
>
> ---------- Forwarded message ----------
> From: Priscilla Walmsley <pwalmsley@xxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Cc:
> Bcc:
> Date: Tue, 20 Jun 2017 13:22:52 -0400
> Subject: XSLT at the XML Summer School 2017
>
> Hello,
>
> We have announced the program for the XML Summer School, which takes place
September
> 17-22 in Oxford, UK.
>
> The XSLT and XQuery course may be of particular interest.  It is an
intermediate
> to advanced course with the goal of helping developers who are currently
> using XSLT to be more effective and efficient.  It's a great opportunity
> to spend some time with XSLT and XQuery experts like Michael Kay, Florent
> Georges and Adam Retter (and me!).  The classes are:
>
> - XSLT and XQuery Performance Workshop (taught by Michael Kay)
>
> - Refactoring XSLT (taught by Priscilla Walmsley)
>
> - Querying XML Databases with XQuery (taught by Adam Retter)
>
> - XSLT 3.0 and XQuery 3.0 (taught by Florent Georges)
>
> There is also quite a lot of XSLT in the Hands-on Digital Publishing
> course for slightly less experienced XSLT developers. Taught by Norm
> Walsh, Peter Flynn, Lauren Wood and Matt Patterson, the classes teach
> practical methods for transforming both XML and Word documents to HTML5
> for Web and ePub publishing.
>
> Of course, the rest of the curriculum and faculty are excellent also. You
can
> find out more at:
>
> *http://xmlsummerschool.com/curriculum-2017/*
> <http://xmlsummerschool.com/curriculum-2017/>
>
> Consider travelling to the beautiful town of Oxford this summer to further
advance
> your XSLT skills and socialize with people with the same interests and
> challenges in a relaxed setting.
>
> Please feel free to contact me if you have any question about the
> curriculum or the Summer School in general.  Hope to see you there!
>
> Priscilla
>
>
> ---------- Forwarded message ----------
> From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc:
> Bcc:
> Date: Tue, 20 Jun 2017 20:03:22 +0200
> Subject: Re: [xsl] XSL Condition is not working
> I donbt understand it fully. The output comprises all of merge1.xmlbs
> Alter__c  items because all meet your conditions.
>
> Why do you expect that the output objects element contains only
> Alert__c[Document_Name__c = 'abcTest.txt']]?
>
> For example, take
> <Alert__c>
>   <Alert_Type__c>Document Downloaded</Alert_Type__c>
>   <Document_Name__c>w.txt</Document_Name__c>
> </Alert__c>
>
> $Email_from_merge1 is 'Document Downloaded'
>
> not(exists($XMLMerge2/objects/Data__c[Alert_Type__c =
> $Email_from_merge1])) is true
> because all Data__c in merge2.xml have an Alert_Type__c of 'Document
> Viewed'
>
> $Email_from_merge2 is 'w.txt'
> $XMLMerge2/objects/Data__c[Document_Name__c = 'w.txt'] exists (there are
> two Data__c with Document_Name__c = 'w.txt').
>
> So for this example both 'if' conditions are true, and for all other
> Alert__c elements, too.
>
> This explains the output, yet it doesnbt explain why it is different from
> your expectations.
>
> Gerrit
>
> On 6/20/17 3:30 PM, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:
>
>> My xsl code is not working as per given expected output. I need data from
>> merge1.xml if Alert_Type__c='Document Downloaded' and
>> Document_Name__c='abcTest.txt' is match with merge2.xml with
>> Document_Name__c='abcTest.txt' and Alert_Type__c!='Document Downloaded'
>>
>> Input
>> Merge1.xml:
>>
>>       <?xml version="1.0" encoding="UTF-8"?>
>>       <objects>
>>       <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>       <Document_Name__c>b (2).txt</Document_Name__c>
>>       </Alert__c>
>>       <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>        <Document_Name__c>w.txt</Document_Name__c>
>>        </Alert__c>
>>        <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>       <Document_Name__c>w.txt</Document_Name__c>
>>       </Alert__c>
>>       <Alert__c>
>>        <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>       <Document_Name__c>file 1.pdf</Document_Name__c>
>>       </Alert__c>
>>       <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>       <Document_Name__c>abcTest.txt</Document_Name__c>
>>       </Alert__c>
>>       <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>        <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>>       </Alert__c>
>>       <Alert__c>
>>       <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>       <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>>        </Alert__c>
>>        </objects>
>>
>> Merge2.xml:
>>
>>      <?xml version="1.0" encoding="UTF-8"?>
>>      <objects>
>>      <Data__c>
>>      <Document_Name__c>abcTest.txt</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>       </Data__c>
>>      <Data__c>
>>      <Document_Name__c>w.txt</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>      </Data__c>
>>      <Data__c>
>>      <Document_Name__c>q.txt</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>       </Data__c>
>>       <Data__c>
>>      <Document_Name__c>file 1.pdf</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>      </Data__c>
>>      <Data__c>
>>      <Document_Name__c>DealRoomData.csv</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>       </Data__c>
>>      <Data__c>
>>      <Document_Name__c>b (2).txt</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>      </Data__c>
>>      <Data__c>
>>      <Document_Name__c>w.txt</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>      </Data__c>
>>      <Data__c>
>>      <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>      </Data__c>
>>      <Data__c>
>>      <Document_Name__c>VICS_810_004010_US.pdf</Document_Name__c>
>>      <Alert_Type__c>Document Viewed</Alert_Type__c>
>>       </Data__c>
>>      </objects>
>>
>> XSL:
>>
>>      <?xml version="1.0" encoding="UTF-8"?>
>>      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>>      xmlns:xs="http://www.w3.org/2001/XMLSchema";
>> exclude-result-prefixes="xs" version="2.0">
>>      <xsl:output method="xml" indent="yes"/>
>>      <xsl:param name="XMLMerge2" select="document('merge2.xml')"/>
>>      <xsl:template match="objects">
>>          <objects>
>>              <xsl:if test="
>>                      $XMLMerge2/objects != ''">
>>                  <xsl:for-each select="Alert__c">
>>                      <xsl:variable name="Email_from_merge1"
>> select="Alert_Type__c"/>
>>                      <xsl:variable name="Email_from_merge2"
>> select="Document_Name__c"/>
>>                      <xsl:if
>>
test="not(exists($XMLMerge2/objects/Data__c[Alert_Type__c
>> = $Email_from_merge1]))">
>>                          <xsl:if
>>
test="exists($XMLMerge2/objects/Data__c[Document_Name__c
>> = $Email_from_merge2])">
>>                              <xsl:copy>
>>                                  <xsl:apply-templates select="@* |
>> node()"/>
>>                              </xsl:copy>
>>                          </xsl:if>
>>                      </xsl:if>
>>                  </xsl:for-each>
>>              </xsl:if>
>>          </objects>
>>        </xsl:template>
>>        <xsl:template match="@* | node()">
>>          <xsl:copy>
>>              <xsl:apply-templates select="@* | node()"/>
>>          </xsl:copy>
>>       </xsl:template>
>>      </xsl:stylesheet>
>>
>> Expected  output:
>>
>>       <?xml version="1.0" encoding="UTF-8"?>
>>       <objects>
>>      <Alert__c>
>>      <Alert_Type__c>Document Downloaded</Alert_Type__c>
>>      <Document_Name__c>abcTest.txt</Document_Name__c>
>>       </Alert__c>
>>      </objects>
>> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>> EasyUnsubscribe <-list/225679>
>> (by email <>)
>>
>
> --
> Gerrit Imsieke
> GeschC$ftsfC<hrer / Managing Director
> le-tex publishing services GmbH
> Weissenfelser Str. 84, 04229 Leipzig, Germany
> Phone +49 341 355356 110, Fax +49 341 355356 510
> gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de
>
> Registergericht / Commercial Register: Amtsgericht Leipzig
> Registernummer / Registration Number: HRB 24930
>
> GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek,
> Thomas Schmidt, Dr. Reinhard VC6ckler

Current Thread