Subject: Re: [xsl] XSLT transforming from soap xml to E2B-R2 xml format From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 7 Jun 2023 16:35:09 -0000 |
When you do <ichicsr lang="en" > in your stylesheet, the resulting element in the output will have copies of all namespaces declared in outer elements in the stylesheet, unless disabled using the exclude-result-prefixes attribute. Michael Kay Saxonica > On 7 Jun 2023, at 17:27, LEGAULT, PHILLIP plegault@xxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > I have 2 XSLT Stylesheets, one to split and one to transform. > The Split one looks like: > > <?xml version="1.0"?> > <xsl:stylesheet version="2.0" > xpath-default-namespace="urn:enterprise.soap.sforce.com <http://enterprise.soap.sforce.com/>" > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ <http://schemas.xmlsoap.org/soap/envelope/>" > 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:output method="xml" indent="yes"/> > <xsl:variable name="dateparam" select="format-dateTime(current-dateTime(),'[Y0001][M01][D01][H01][m01][s01]' )"></xsl:variable> > <xsl:template match="/"> > <xsl:apply-templates/> > </xsl:template> > > <xsl:template match="records[@xsi:type = 'sf:Case']"> > <xsl:result-document href="./tmp/{sf:Product_GCC__r/sf:Locale_GCC__r/sf:Region_GCC__c}-{$dateparam }-case-{sf:Id}-{sf:CaseNumber}.xml"> > <xsl:copy-of select="."/> > </xsl:result-document> > </xsl:template> > </xsl:stylesheet> > > > The transform is quite large. > > Starts like: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="2.0" > xpath-default-namespace="urn:enterprise.soap.sforce.com <http://enterprise.soap.sforce.com/>" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform <http://www.w3.org/1999/XSL/Transform>" > xmlns="urn:enterprise.soap.sforce.com <http://enterprise.soap.sforce.com/>" > 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:variable name="codes"> > > </xsl:variable> > <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> > <xsl:strip-space elements="*"/> > <xsl:template match="/"> > <ichicsr lang="en" > > <ichicsrmessageheader> > <messagetype>ichicsr</messagetype> > <messageformatversion>2.1</messageformatversion> > <messageformatrelease>2.0</messageformatrelease> > <messageid><xsl:value-of select="/records/sf:Id"/></messageid> > <xsl:for-each select="/records/sf:Case_CaseNotes_GCC__r/records"><xsl:choose> > <xsl:when test="sf:Type_GCC__c = 'Safety Feedback'"> > <commentid><xsl:value-of select="sf:Id"/></commentid> > </xsl:when> > <xsl:otherwise> > <xsl:text></xsl:text> > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > > > > > > > From: Michael Kay mike@xxxxxxxxxxxx <mailto:mike@xxxxxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> > Sent: Wednesday, June 7, 2023 11:44 AM > To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>> > Subject: [EXTERNAL] Re: [xsl] XSLT transforming from soap xml to E2B-R2 xml format > > We can't tell why you're getting the unwanted namespaces without seeing your code. The main reasons for unwanted namespaces are either > > (a) you copied them from the source document using xsl:copy or xsl:copy-of. In XSLT 2.0+ you can use the copy-namespaces="no" attribute to prevent this > > (b) you copied them from the stylesheet by using a literal result element without specifying exclude-result-prefixes. > > The desired output also looks odd because it has an XML declaration inside the outermost element. > > You can get the DOCTYPE declaration in the output by using `xsl:output` with the doctype-system option > > > On 7 Jun 2023, at 16:28, LEGAULT, PHILLIP plegault@xxxxxxxxxx <mailto:plegault@xxxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote: > > Ibm splitting a large soap xml file into multiple files then running a transformation on each file. > Ibm left with: > > <?xml version="1.0" encoding="UTF-8"?> > <ichicsr xmlns="urn:enterprise.soap.sforce.com <http://enterprise.soap.sforce.com/>" > 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>" > lang="en"> > b&b&.. > b&b&b& > </ichicsr> > > What I want to end up with is like: > <xmlFile> > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE ichicsr SYSTEM "http://eudravigilance.ema.europa.eu/dtd/icsr21xml.dtd <http://eudravigilance.ema.europa.eu/dtd/icsr21xml.dtd>"> > > b&b&b&b&b&.. > b&b&b&b&.. > > </ichicsr> > </xmlFile> > > > > Then > > Phil Legault > RDx Platform Lead > > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (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 <applewebdata://09EC872E-0947-4D0C-9CC7-B712EDE4C547>) > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT transforming from so, LEGAULT, PHILLIP ple | Thread | Re: [xsl] XSLT transforming from so, LEGAULT, PHILLIP ple |
Re: [xsl] XSLT transforming from so, LEGAULT, PHILLIP ple | Date | Re: [xsl] XSLT transforming from so, LEGAULT, PHILLIP ple |
Month |