xslt-grouping

dependency graph traversal in XSLT for copying related elements of an XML model

孤街浪徒 提交于 2021-01-29 17:34:52
问题 I want to demonstrate XSL powerfullness for data exploration by solving the following problem: Given an xml file that describes some kind of "entity-relashionship" model, and for one entity in that model given by a name (assuming an attribute of the XML schema is used as identifier), I want a transformation that produce a new XML model that contains the given entity, plus all of its relatives as per the "Transitive closure of the dependencies relationship" of that given entity. For example,

Right padding a String with Zeros in XSLT

余生长醉 提交于 2021-01-29 06:50:48
问题 I need to right pad this with leading zeros to a length of 3 in the output (which is fixed length text) Examples: A becomes A00 AB becomes AB0 ABC becomes ABC Please help. 回答1: You could do simply: substring(concat($your-string, '000'), 1, 3) Note that this means that "ABCD" becomes "ABC" . 来源: https://stackoverflow.com/questions/65317883/right-padding-a-string-with-zeros-in-xslt

Extract value from one XML while matching template in other XML using XSLT

Deadly 提交于 2020-06-17 13:22:08
问题 I have 2 XMLs. I am trying to run XSLT on 1st XML and matching data in 2nd XML using keys. While doing template-match on 2nd XML,I am unable to pull data from 1st XML's matching node(dont know how to pull any data from there per say) and populate it in there. Below are samples and expected output. 1st XML- <parent> <child> <name>John</name> <city>Boston</city> <shortCityCode>B</shortCityCode> </child> <child> <name>John</name> <city>Seattle</city> <shortCityCode>S</shortCityCode> </child>

SubGroup in xslt with mutiple keys

为君一笑 提交于 2020-06-17 11:07:18
问题 I have a source xml like below. Im trying to convert to a desired format using xslt as shown below. Sample XML <table> <row> <tablename>table1</tablename> <tableDesc>table1_desc</tableDesc> <columnname>col1</columnname> <columnDesc>col1_desc</columnDesc> <columnDataType>Number</columnDataType> <ultimateSourceTable>sourceTable1</ultimateSourceTable> <ultimateSourceTableDesc>col1sourceTable1_desc</ultimateSourceTableDesc> </row> <row> <tablename>table1</tablename> <tableDesc>table1_desc<

Create XML based on 2 XMLs and looking up values in both files using XSLT2.0

穿精又带淫゛_ 提交于 2020-04-30 06:24:49
问题 I am trying to generate a XML based on 2 other XMLs. I am polling a DB that returns details of people(There can be n number of people returned in query). The final XML should have the exact number of Data tags as the distinct name tags in the XML coming from DB . For Ex: 1st XML- Getting this from DB <parent> <child> <name>John</name> <city>Boston</city> </child> <child> <name>John</name> <city>Seattle</city> </child> <child> <name>Allison</name> <city>Houston</city> </child> </parent> 2nd

Count the lines after grouping data in XSLT

回眸只為那壹抹淺笑 提交于 2020-02-07 02:35:25
问题 I need to get the number of rows in the output after the data have been grouped. XML input file looks like this: <?xml version='1.0' encoding='UTF-8'?> <root> <entry> <ID>T-1149</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>20.00</Amount> </Item_Amount> </entry> <entry> <ID>T-1149</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>10.00</Amount> </Item_Amount> </entry> <entry> <ID>T-1142</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>10.00</Amount> </Item_Amount> </entry> <entry> <ID>T

Adjust an alphabetical index from xml grouping to make columns equal

空扰寡人 提交于 2020-01-17 03:44:10
问题 Here is a scenario where an alphabetical index is created into 3 columns. But, the approach for dividing them into columns has some scope of improvement. Creating alphabetical index with fixed number of columns in XSLT 2.0 In the above scenario, is there a way if the 3 columns can be made as much equal as possible without breaking a letter group. 回答1: I would suggest the following approach: XSLT 2.0 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output

XSLT finding distinct combinations

本小妞迷上赌 提交于 2020-01-15 10:53:24
问题 I am beginner to xslt. I want to find all unique combinations for Year, Month, Day, and Hour. I have following xml file to transform: <Plans> <Plan Name="Plan_1"> <Book Name="Book_1"> <Time Name="AAA"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour" Value="12"/> </Time> <Time Name="BBB"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour

XSLT finding distinct combinations

十年热恋 提交于 2020-01-15 10:52:35
问题 I am beginner to xslt. I want to find all unique combinations for Year, Month, Day, and Hour. I have following xml file to transform: <Plans> <Plan Name="Plan_1"> <Book Name="Book_1"> <Time Name="AAA"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour" Value="12"/> </Time> <Time Name="BBB"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour

XSLT finding distinct combinations

丶灬走出姿态 提交于 2020-01-15 10:52:22
问题 I am beginner to xslt. I want to find all unique combinations for Year, Month, Day, and Hour. I have following xml file to transform: <Plans> <Plan Name="Plan_1"> <Book Name="Book_1"> <Time Name="AAA"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour" Value="12"/> </Time> <Time Name="BBB"> <Property Name="Year" Value="2001"/> <Property Name="Month" Value="01"/> <Property Name="Day" Value="10"/> <Property Name="Hour