Re: [xsl] creating multiple xml documents from one large xml document

Subject: Re: [xsl] creating multiple xml documents from one large xml document
From: "LEGAULT, PHILLIP plegault@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 May 2023 12:39:08 -0000
I tried adding the namespace and still nothing

From: Michael Kay mike@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, May 29, 2023 8:14 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL] Re: [xsl] creating multiple xml documents from one large
xml document

Standard namespace problem (often seen with SOAP): your elements are in a
namespace

 xmlns="urn:enterprise.soap.sforce.com<http://enterprise.soap.sforce.com/>"

which you ignored when trying to match them.

Michael Kay
Saxonica


On 29 May 2023, at 12:43, LEGAULT, PHILLIP
plegault@xxxxxxxxxx<mailto:plegault@xxxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>> wrote:


From: Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx<mailto:s.bauman@xxxxxxxxxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>>
Sent: Friday, May 26, 2023 9:55 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Re: [xsl] creating multiple xml documents from one large
xml document

(Confession: I did not understand the original question.)

If you are not getting any result file the two most likely culprits are

  1.  namespace problem
  2.  you are calling the program incorrectly
I am guessing that you are calling the xslt2b program correctly (i.e., its
signature is xslt2 [input] [stylesheet] [output]b), because if not, you
would probably get an error (like bStylesheet file is not really a
stylesheetb), not just no output.
I notice that in the code you posted, the <records> element is being matched
as if it were in no namespace. If that is true (the <records> element(s) in
soap.xml are in no namespace), then we need to look elsewhere for a problem.
If it is not true (the <records> element(s) in soap.xml are in a namespace,
e.g. "http://www.w3.org/2003/05/soap-envelope/";), then that is the problem.
Using either
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:sf="urn:sobject.enterprise.soap.sforce.com<http://sobject.enterpris
e.soap.sforce.com/>"
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope/";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<xsl:template match="soap:records[@xsi:type eq 'sf:CaseNote_GCC__c']">
...
or
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:sf="urn:sobject.enterprise.soap.sforce.com<http://sobject.enterpris
e.soap.sforce.com/>"
    xpath-default-namespace="http://www.w3.org/2003/05/soap-envelope/";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
...
should do the trick.

________________________________
Ibm using Saxon XSLT 2

Calling it like: xslt2 soap.xml file.xsl hello.htm

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:sf="urn:sobject.enterprise.soap.sforce.com<http://sobject.enterpris
e.soap.sforce.com/>"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<xsl:template match="records[@xsi:type = 'sf:CaseNote_GCC__c']">
   <xsl:result-document href="case-{sf:Id}-{sf:CaseNumber}.xml">
     <xsl:copy-of select="."/>
  </xsl:result-document>
</xsl:template>
</xsl:stylesheet>


Not getting any result files.


XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/649132> (by
email)
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3514465> (by
email)
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3500899> (by
email)

XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3514465> (by
email<>)

Current Thread