xslt-2.0

Merge XML nodes based on Certain Key Value using XSLT

浪尽此生 提交于 2020-01-06 05:52:06
问题 Merge XML nodes based on ReferenceNumber Value How to merge the xml request to the output given below using XSLT based on the Key value. Basically the xml response has to be merged for ReferenceNumber, along with the respective ProductCode and SecondaryDivision. Below is the Request and the Expected response. I tried Using following XSLT but it did not gave desired result. Below is the XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="refNo"

XSL 1.0 group by and sum SalesAmount and related / joined Tax records

笑着哭i 提交于 2020-01-06 04:51:06
问题 I have an invoice xml where I need to perform a grouping / sum on itemid's For instance for ItemId 444 I need a lineamount of 100 + 25 = 125 and ItemId 555 = 200 + 15. Lot's of examples out there how to do this you're about to say but I have another requirement. I also need to do the same grouping and sum for my TaxTrans\TaxAmounts and TaxTrans\TaxBaseAmounts based on the joining InventTransId field (AABB / BBCC) between CustInvoiceTrans and TaxTrans. Before: <CustInvoiceJour class="entity">

How to group consecutive dates in XSLT?

巧了我就是萌 提交于 2020-01-06 04:45:06
问题 I have an xml file (sample below) and I want to group this xml based on consecutive Time_Off_Date. <Root> <Entry> <Employee_ID>101</Employee_ID> <Time_Off_Details> <Time_Off_Date>2017-12-01</Time_Off_Date> </Time_Off_Details> <Time_Off_Details> <Time_Off_Date>2017-12-02</Time_Off_Date> </Time_Off_Details> <Time_Off_Details> <Time_Off_Date>2017-12-04</Time_Off_Date> </Time_Off_Details> <Time_Off_Details> <Time_Off_Date>2017-12-05</Time_Off_Date> </Time_Off_Details> </Entry> <Entry> <Employee

Iterate and apply XSLT identity transformation to directory of documents?

三世轮回 提交于 2020-01-06 02:44:32
问题 I have a folder with HTML files which look more or less like this: <div id="d10e3019" class="content"> <h1>header</h1> <div class="adv"> <div class="warn"> <img width="60px" height="20px" src="img/warn.png" alt="WARNING"></img> <p class="cause">gfgfg!</p> <p>⇒ Thgfh</p> <p class="step">⇔ <span class="emphasis">hgfh </p> </div> </div> </div> They all have <div id="someId" class="content"> as root element and then just various HTML markup. I need to change all of the src attributes in the img

Error when running XSLT with eclipse

北城以北 提交于 2020-01-06 01:36:36
问题 When I use eclipse xsl development tools to run xsl transformation, it reports the following error. But using saxon there is no problem. SIt would be appreciated if some expert can provide possible solution. 12:44:14,714 INFO [main] Main - javax.xml.transform.TransformerFactory=null 12:44:14,725 INFO [main] Main - java.endorsed.dirs=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/endorsed 12:44:14,744 INFO [main] Main - launchFile: /gpfs/work01/work/scratch/users/feifan_liu/.metadata/

Format numbers in XML using XSLT

瘦欲@ 提交于 2020-01-05 12:11:36
问题 I have one number in my input xml file like this 0.20 but I want to change to 0,20(comma instead of dot) in my output xml file through xslt. How can I format this number? I don't want to use any templates for it. 回答1: Use format-number($x, '0.00', 'european') in conjuction with <xsl:decimal-format name="european" decimal-separator="," grouping-separator="."/> 回答2: There are different approaches based on which XSLT version you are using. Assuming you have the value 0.20 in an element as below

Find child of child which attribute code is equal to the parameter passed on the url - XSL

白昼怎懂夜的黑 提交于 2020-01-05 09:28:29
问题 On this dynamic website, The url looks something like this : departments/CHEM.html CHEM is a parameter. <xsl:param name="dep" select="'CHEM'" /> a piece of the xml is below <course acad_year="2012" cat_num="5085" offered="Y"> <term term_pattern_code="1" fall_term="Y" spring_term="N">fall term</term> <department code="CHEM"> <dept_long_name>Department of Chemistry and Chemical Biology</dept_long_name> <dept_short_name>Chemistry and Chemical Biology</dept_short_name> </department> </course> ...

Complex XML to TSV using XSLT

风格不统一 提交于 2020-01-04 15:54:31
问题 I have found a couple of previous questions that address parts of my problem (see here and here, but I'm having trouble integrating them. I have a set of XML records that I want to transform to tab-delimited format. However, not all the XML records have all fields, and some contain multiple instances of a field. Two sample XML records: <?xml version="1.0" encoding="UTF-8" ?> <marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

Complex XML to TSV using XSLT

痴心易碎 提交于 2020-01-04 15:52:54
问题 I have found a couple of previous questions that address parts of my problem (see here and here, but I'm having trouble integrating them. I have a set of XML records that I want to transform to tab-delimited format. However, not all the XML records have all fields, and some contain multiple instances of a field. Two sample XML records: <?xml version="1.0" encoding="UTF-8" ?> <marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

Can't get correct XSLT output

霸气de小男生 提交于 2020-01-04 15:27:28
问题 I have a XML like this: <?xml version="1.0" encoding="UTF-8"?> <Section> <Chapter> <nametable> <namerow> <namecell stuff="1"> <entity>A</entity> </namecell> <namecell stuff="2"> <entity>B</entity> </namecell> </namerow> </nametable> </Chapter> </Section> My XSLT is like this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates select="Section/Chapter/