xslt-2.0

Concatenate values of elements to a variable with the usage of a template?

倖福魔咒の 提交于 2019-12-13 07:37:56
问题 The following data need to be concatenated. But the XML document which I received can have "zero to n" b elements. In other words if there are no b elements the xslt should still work correctly example: <a> <b1>Some</b2> <b2>data</b2> <b3>what</b3> <b4>need</b4> <b5>to</b5> <b6>be</b6> <b7>concatenated</b7> </a> Expected result <a> <b1>Some data what need to be concatenated</b1> </a> I was trying the following construction but I couldn't made it work. <xsl:variable name="details" select="//b*

Grouping based on conditions and putting them into a single row in XSLT Transformation

爱⌒轻易说出口 提交于 2019-12-13 06:54:48
问题 I am facing a problem in transformation of XML. I need to transform an output in csv file as with ',' seperated. XML: <Root> <Employees> <Employee> <Co_Code>DEEP1</Co_Code> <ID>12345</ID> </Employee> <Type Descriptor="Phone"></Type> <amount1>8</amount1> </Employees> <Employees> <Employee> <Co_Code>DEEP1</Co_Code> <ID>12345</ID> </Employee> <Type Descriptor="Phone"></Type> <amount>6</amount> </Employees> <Employees> <Employee> <Co_Code>DEEP1</Co_Code> <ID>12345</ID> </Employee> <Type

sequence in transformation using xslt

廉价感情. 提交于 2019-12-13 06:47:34
问题 I am working on xml transformation from XML to XML. I have XSD defined for newly transformed XML. XSD has some predefined sequence/order for each element. How can I make same sequence from XSD will appears while XML transformation? I tried to arrange transformation sequence as same order as in my XSD but learnt that transformation sequence is not same as xslt execution sequence. Appreciate your response <ROOT> <A1>A</A1> <B1>B</B1> <C1>C</C1> <D1>D</D1> </ROOT> <ROOT> <a1>A</a1> <d1>D</d1>

xsl:for-each-group positional grouping flat xml to hierarchical

▼魔方 西西 提交于 2019-12-13 05:59:32
问题 I have a flat xml file that needs to be converted to hierarchical. I used the nested grouping idea from here xsl:for-each-group help needed. It's working for the most part except for a couple of issues: 1) The elements root1 and root2 are not showing up. 2) The location of element NFActy is incorrect. The first NFActy should be between the 2 Rot elements. 3) The Duty & NFActy elements are treated as one group for calculating the SequenceCount. 4) For Leg elements each set of Leg elements

Mule 3.4.2 XSLT Transformer throws Cannot write more than one result document to the same URI, or write to a URI that has been read

夙愿已清 提交于 2019-12-13 05:43:29
问题 I have XML coming to a mule flow. I need to break this xml into 3 different xml and write to 3 files. This is how I call XSLT Transformer in mule flow. <xm:xslt-transformer xsl-file="xsl/xml-to-file.xsl"> <xm:context-property key="A_loc" value="${location.a}" /> <xm:context-property key="B_loc" value="${location.b}" /> <xm:context-property key="C_loc" value="${location.c}" /> </xm:xslt-transformer> And this is how the xsl is defined: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org

Add xsi:nil=“true” for empty elements

拜拜、爱过 提交于 2019-12-13 05:09:04
问题 I am trying to figure out a way to add xsi:nil="true" for empty elements. I could write a separate xsl on the output to achieve this, but trying to figure out if I could have it written in the current xsl itself. Current XSL <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"> <xsl:output method="xml" indent="yes"/>

Why do I get the following exception 'first argument to the non-static Java function'?

房东的猫 提交于 2019-12-13 04:56:52
问题 I get this exception: FATAL ERROR: 'The first argument to the non-static Java function *** is not a valid object reference.' This happens when I try to transform an XML document using the xml-maven-plugin. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>xml-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <goals> <goal>transform</goal> </goals> </execution> </executions> <configuration> <transformationSets> <transformationSet> <dir>target/generated/wsdl</dir

apply templates select substring-after

自古美人都是妖i 提交于 2019-12-13 04:44:02
问题 I've the below XML line. <toc-title>1. <content-style>Short title</content-style></toc-title> here i wanted to apply templates on substring-after 1. I tried the below XSLT. <xsl:template match="toc-title/text()" mode="x"> <xsl:analyze-string select="substring-after(.,' ')" regex="([a-z]+)"> <xsl:matching-substring> <xsl:apply-templates select="regex-group(1)" mode="x"/> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl

merge parent and child attributes using xslt based on attribute values

笑着哭i 提交于 2019-12-13 04:37:07
问题 I have an xml file which contains the following markup, I know the format of this file is not correct but that's how the file is. <?xml version="1.0" encoding="UTF-8"?> <mbean code="org.book.mybooks" name="mycompany.props.jndi:name=mybookprops"> <attribute name="CombineProps" serialDataType="jbxb"> <jndi:bindings xmlns:jndi="urn:jboss:jndi-binding-service:1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding

How to extend a Muenchian XML grouping?

此生再无相见时 提交于 2019-12-13 04:32:02
问题 I have this XML: <events> <event name="Christmas" attendees="1"/> <event name="Halloween" attendees="3"/> <event name="Easter" attendees="2"/> <event name="Easter" attendees="1"/> </events> Thanks to hr_117 's help, I managed to do this: <xsl:template match="data"> <xsl:apply-templates select="events"/> </xsl:template> <xsl:key name="events-by-name" match="events/event" use="@name" /> <xsl:template match="events"> <xsl:for-each select="event[count(. | key('events-by-name', @name)[1]) = 1]">