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

Subject: Re: [xsl] creating multiple xml documents from one large xml document
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 May 2023 07:41:13 -0000
First, run with -t which will tell you if you are getting any result files
(they might be there, but not where you expected).

Then try with -T to see if your template rule is actually being invoked.

If not, then check whether the "records" element is in a namespace.

Michael Kay
Saxonica

> On 26 May 2023, at 23:48, LEGAULT, PHILLIP plegault@xxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Martin,
> 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
<http://www.w3.org/1999/XSL/Transform>"
>     xmlns:sf="urn:sobject.enterprise.soap.sforce.com
<http://sobject.enterprise.soap.sforce.com/>"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<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.
>
>
>
> From: Martin Honnen martin.honnen@xxxxxx <mailto:martin.honnen@xxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx
<mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>>
> Sent: Friday, May 26, 2023 4:42 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: [EXTERNAL] Re: [xsl] creating multiple xml documents from one large
xml document
>
>
>
> On 5/26/2023 9:50 PM, LEGAULT, PHILLIP plegault@xxxxxxxxxx
<mailto:plegault@xxxxxxxxxx> wrote:
> Ibm working with salesforce soap xml, 3 namespaces, I am splitting them
currently with python. I need a simpler way and hoping I can do it with XML.
>
> Each case has this as the beginning node and element of course with the end
tag, for each case I want everything in between in each file.
> If there is no case node skip
>
> <records xsi:type="sf:CaseNote_GCC__c">
> Insert child node with date it was created
>
> There are 2 child nodes I want to name the file with
<sf:Id>xxxxxxxxxxxxxx</sf:Id> and <sf:CaseNumber>xxxxxxxxxxx</sf:CaseNumber>
>
> If you use an XSLT 2 or 3 processor (e.g. Saxon) you can easily match on a
certain element and create a result document with e.g.
>
>
>
>  <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>
>
>
>
> I don't quite understand what you refer to with "If there is no case node
skip" but it can probably easily expressed in another predicate of the match
pattern.
>
> Consider to show the relevant XML sample if you need more help with that.
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3514465> (by
email <applewebdata://47CB431D-2F74-45BD-B8C0-4CBE130B85AA>)
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by
email <>)

Current Thread