[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: creating multiple xml documents from one large xml
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" xmlns:sf="urn:sobject.enterprise.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. From: Martin Honnen martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Friday, May 26, 2023 4:42 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [EXTERNAL] Re: 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<>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|