xslt-grouping

XSL muenchian-grouping on multiple levels and nesting

拟墨画扇 提交于 2019-12-10 22:17:53
问题 INPUT: <?xml version="1.0" encoding="UTF-8"?> <root> <output> <queries> <query> <parameters> <parameter name="id">CTL-000002</parameter> </parameters> <queryResults> <record id="1"> <column name="ConfigurationCapacity">9500.0000000</column> <column name="configurationCode">CTL-3819</column> <column name="compartmentCode">CTL-3819-01</column> <column name="position">1</column> <column name="CompartmentCapacity">2700</column> <column name="unitName">G</column> </record> <record id="2"> <column

XSLT 3.0 Streaming with Grouping and Sum/Accumulator

≯℡__Kan透↙ 提交于 2019-12-10 21:16:11
问题 I'm trying to figure out how to use XSLT Streaming (to reduce memory usage) in a scenario that requires grouping (with an arbitrary number of groups) and summing the group. So far I haven't been able to find any examples. Here's an example XML <?xml version='1.0' encoding='UTF-8'?> <Data> <Entry> <Genre>Fantasy</Genre> <Condition>New</Condition> <Format>Hardback</Format> <Title>Birds</Title> <Count>3</Count> </Entry> <Entry> <Genre>Fantasy</Genre> <Condition>New</Condition> <Format>Hardback<

Sort data in the xml alphabetical order

雨燕双飞 提交于 2019-12-10 10:16:43
问题 Input XML : <?xml version="1.0" encoding="utf-8" ?> <infoset> <info> <title>Bill</title> <group> <code>state</code> </group> </info> <info> <title>Auto</title> <group> <code>state</code> </group> </info> <info> <title>Auto2</title> </info> <info> <title>Auto3</title> </info> <info> <title>Auto5</title> </info> <info> <title>Certificate</title> <group> <code>Auto4</code> </group> </info> </infoset> Expected output : A Auto2 Auto3 Auto4 Certificate Auto5 S state Auto Bill I need to arrange the

XSL to create nested list from flat tree problem

て烟熏妆下的殇ゞ 提交于 2019-12-10 07:32:48
问题 I need to be able to create nested lists from a flat tree. For example, the input might be something like this: <root> <h1>text</h1> <list level="1">num1</list> <list level="1">num2</list> <list level="2">sub-num1</list> <list level="2">sub-num2</list> <list level="3">sub-sub-num1</list> <list level="1">num3</list> <p>text</p> <list>num1</list> <list>num2</list> <h2>text</h2> </root> and the output should be nested as follows: <root> <h1>text</h1> <ol> <li>num1</li> <li>num2 <ol> <li>sub-num1

Display X distinct random node sets using XSLT 1.0

ⅰ亾dé卋堺 提交于 2019-12-08 06:56:48
问题 I've got a simple xsl code to display some dynamically xml. <xsl:template match="/"> <xsl:for-each select="NewDataSet/Vehicle"> <div class="item"> <xsl:value-of select="ManufacturerName" /><br /> <xsl:value-of select="Model" /><br /> <xsl:value-of select="Colour" /><br /> £<xsl:value-of select='format-number(Price, "###,###,##0.")' /> </div> </xsl:for-each> </xsl:template> What I'd like to be able to do is display X number of random distinct node sets instead of all of them. Is this possible

Access attribute from within current-grouping-key() xslt

て烟熏妆下的殇ゞ 提交于 2019-12-08 03:00:28
I have some xml with thousands of movie elements which can all have 1 or MORE director and writer elements, if a director or writer has the same name as another, as seen here, I add an @differentiator of birthyear, if they are NOT the same person <mediaList> <movie id="1603934" dateCreated="2014-08-11"> <title>Night at the Museum</title> <director>Shawn Levy</director> <LCSpecialTopics>Comedy</LCSpecialTopics> <writer>Robert Ben Garant</writer> <writer differentiator="1970">Thomas Lennon</writer> <language>English</language> <year>2006</year> </movie> <movie lastModified="2014-08-30" id=

Converting CSV to hierarchichal XML using XSLT

自闭症网瘾萝莉.ら 提交于 2019-12-06 16:15:30
问题 I need to create an XSLT to convert a CSV (comma separated file) into hierarchical XML. This is the input file: <root> L11,L12,L21,L22,L31,L32 1,A,1,C,1,G 1,A,1,C,2,H 1,A,2,D,1,I 1,A,2,D,2,J 2,B,1,E,1,K 2,B,1,E,2,L 2,B,2,F,1,M 2,B,2,F,2,N </root> This is desired output XML: <?xml version="1.0" encoding="utf-8"?> <Document> <Level1> <L11>1</L11> <L12>A</L12> <Level2> <L21>1</L11> <L22>C</L12> <Level3> <L31>1</L31> <L32>G</L32> </Level3> <Level3> <L31>2</L31> <L32>H</L32> </Level3> </Level2>

XSLT group if condition is matched

孤者浪人 提交于 2019-12-02 16:23:34
问题 INPUT: <?xml version="1.0" encoding="UTF-8"?> <output> <input> <!--details--> </input> <meta2> <tag> <output_getquerydata> <queries> <query name="part1"> <parameters> <!--details--> </parameters> <queryErrors> <!--details--> </queryErrors> <queryResults> <record id="1"> <column name="VRIdTask">1</column> <column name="MSTP">22</column> <column name="VRPlanId">11310224</column> <column name="MSONPC">221</column> </record> <record id="2"> <column name="VRIdTask">1</column> <column name="MSTP"

Grouping flat xml using xslt (muenchian grouping), can't get it to group

…衆ロ難τιáo~ 提交于 2019-12-02 14:54:46
问题 I spent quite some time trying to get muenchian grouping of the below xml to work but I can't get it to work. I tried a number of different ways so posting the most recent attempt probably just confuses anyone trying to help me. :-) Xslt needs to be 1.0 Input file is invoice lines where "invoice header info" is duplicated for each line belonging to a particular invoice. Grouping should be made in field _id, i e value in RESULTSET/ROW"/COL[12]/DATA (e. g. 'C82F1B47-9758-4D18-ABD7-80386385F6AD'

XSLT grouping and summing

别来无恙 提交于 2019-12-02 12:42:41
I am new to XSLT and need to sum the total price (Quantity * UnitPrice) of items based on ID from each orders, and print it at the end of each Item's group using XSLT 1.0. Here is my example XML <Orders> <Order> <Reference>234</Reference> <Item> <ID>10</ID> <Quantity>1</Quantity> <UnitPrice>2</UnitPrice> </Item> <Item> <ID>10</ID> <Quantity>2</Quantity> <UnitPrice>3</UnitPrice> </Item> <Item> <ID>10</ID> <Quantity>2</Quantity> <UnitPrice>2</UnitPrice> </Item> <Item> <ID>20</ID> <Quantity>2</Quantity> <UnitPrice>4</UnitPrice> </Item> </Order> <Order> <Reference>456</Reference> <Item> <ID>10</ID