xslt-grouping

Counting distinct items in XSLT independent of depth

假装没事ソ 提交于 2019-12-24 10:37:57
问题 If I run the following XSLT code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:key name="kValueByVal" match="variable_name/@value" use="."/> <xsl:template match="assessment"> <xsl:for-each select=" /*/*/variable/attributes/variable_name/@value [generate-id() = generate-id(key('kValueByVal', .)[1]) ] "> <xsl:value-of select= "concat(., ' ', count(key('kValueByVal', .)), ' ')"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>

xslt: select unique node via intermediate reference node?

喜欢而已 提交于 2019-12-24 08:55:32
问题 XSLT 2. Hi, I have an xml that has 3 nodes, named from point of view of the 'children' called: Children, Fathers and MothersFathers. Starting with the Fathers node I need to find the a childs MothersFather node based on the ID's in the Child nodes (the Child node is the intermediate reference joining the other two.) So, for each Father get his children's distinct MothersFather - these aren't humans, a father could have hundreds of children but only twenty or so of the related MothersFathers :

How to create html list from flat xml file using XSLT

拥有回忆 提交于 2019-12-23 06:08:03
问题 I am looking for a clean way to do the following using XSLT. Convert this source: <para>blah blah</para> <list>num1</list> <list>num2</list> <list>num3</list> <para>blah blah</para> <list>num1</list> <list>num2</list> <para>blah blah blah blah blah</para> To this output: <p>blah blah</p> <ol> <li>num1</li> <li>num2</li> <li>num3</li> </ol> <p>blah blah</p> <ol> <li>num1</li> <li>num2</li> </ol> <p>blah blah blah blah blah</p> Keep in mind I do not know exactly how many <list> 's there will be

Groups two xml files like a sql group-by

孤人 提交于 2019-12-23 02:47:05
问题 With the following file as input of xsltprocessor : mylibrary.xml : <library> <book isbn="1"/> <book isbn="3"/> <book isbn="5"/> </library> and this one that can be used : bookreference.xml : <reference> <book isbn="1"> <category>SF</category> </book> <book isbn="2"> <category>SF</category> </book> <book isbn="3"> <category>SF</category> </book> <book isbn="4"> <category>Comedy</category> </book> <book isbn="5"> <category>Comedy</category> </book> </reference> i want to get the numbers of

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

▼魔方 西西 提交于 2019-12-23 01:15:13
问题 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<

XSLT grouping and summing

主宰稳场 提交于 2019-12-20 07:35:52
问题 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<

XSLT 1.0 Grouping

北战南征 提交于 2019-12-20 07:21:38
问题 I need to apply XSLT 1.0 transformation to following XML: <ProfitLossFinancials> <ProfitLossFinancial> <Year>2013</Year> <Turnover>13</Turnover> <Profit>13</Profit> </ProfitLossFinancial> <ProfitLossFinancial> <Year>2012</Year> <Turnover>12</Turnover> <Profit>12</Profit> </ProfitLossFinancial> </ProfitLossFinancials> <BalanceSheetFinancials> <BalanceSheetFinancial> <Year>2013</Year> <FixedAssets>13</FixedAssets> </BalanceSheetFinancial> <BalanceSheetFinancial> <Year>2011</Year> <FixedAssets

XSLT Removal of duplicate with multiple loops

妖精的绣舞 提交于 2019-12-14 03:26:50
问题 I have to convert the below XML using the XSLT. Input XML is <document> <item> <ID>1000909090</ID> <flex> <attrGroupMany name="pageinfo"> <row> <attrQualMany name="pageinput"> <value qual="en">User Intake</value> </attrQualMany> <attrGroupMany name="pagetype"> <row> <attr name="pagemeasure">EXACT</attr> <attrQualMany name="pagecontain"> <value qual="GR1">20</value> <value qual="GR2">21</value> </attrQualMany> </row> <row> <attr name="pagemeasure">EXACT</attr> <attrQualMany name="pagecontain">

Grouping elements and deleting duplicate nodes - XSLT 1.0

情到浓时终转凉″ 提交于 2019-12-14 00:35:58
问题 I have looked at Muenchian Grouping - group within a node, not within the entire document but it is not quite working for me. The Muenchian method alone does not do it either for me. I have also looked at XSLT 1.0: grouping and removing duplicate but cannot follow it completely. I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <MT_MATERIALDATA> <items item="475053"> <Recordset> <CodeBusinessUnit>99</CodeBusinessUnit> <PriceValue>250</PriceValue> </Recordset> <Recordset>

Match and Merge in XSLT 1.0

回眸只為那壹抹淺笑 提交于 2019-12-13 21:32:57
问题 I have a sample XML message which contains multiple parent node. The requirement is something like if the two parent node are same, merge the child node. Sample Input Message is <document> <party> <gtin>1000909090</gtin> <pos> <attrGroupMany name="temperatureInformation"> <row> <attr name="temperatureCode">STORAGE</attr> <attrQualMany name="temperature"> <value qual="FAH">10</value> <value qual="CC">20</value> </attrQualMany> <attrGroupMany name="temperatureStats"> <row> <attr name="StatsCode