xslt-1.0

XSLT 1.0: Sorting by concating portions of date string

一笑奈何 提交于 2019-12-20 04:38:06
问题 I'm trying to take XML data and sort elements by their data attribute. Unfortunately the dates come over in mm/dd/yyyy format and are not static lengths. (Jan = 1 instead of 01) So I believe the string will have to be parsed into three components and the month padded. The newly concated value (yyyymmdd) then sorted descending. Problem is I have no idea how to do this. Here is an example of the data <content date="1/13/2011 1:21:00 PM"> <collection vo="promotion"> <data vo="promotion"

XSLT 1.0 (xsltproc) - Unable to Parse Huge XML

筅森魡賤 提交于 2019-12-20 03:54:14
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. InsecureNoob wants to draw more attention to this question: “Just a fix for the error needed. Bounty guaranteed” I am trying to parse an input xml file that is 13,00,000 lines long with a size of 56 MB, using xsltproc. I get the below error: input.xml:245393: parser error : internal error: Huge input lookup "description" : "List of values for possible department codes" ^ unable to parse input.xml

xslt compare two different nodes and then combine

核能气质少年 提交于 2019-12-20 03:12:10
问题 I have a requirement where i need to show the difference amount ( <TotalAmount> ) based on two different values which is in different section.The input xml as below. <TXLife xmlns="http://ACORD.org/Standards/Life/2"> <TXLifeRequest> <FundCode>LTRW00</FundCode> <AccountNumber>34142</AccountNumber> <ReversalInd>Cr</ReversalInd> <TotalAmount>1600</TotalAmount> </TXLifeRequest> <TXLifeRequest> <FundCode>LTRW00</FundCode> <AccountNumber>34142</AccountNumber> <ReversalInd>Dr</ReversalInd>

Pass absolute file path from java code to xslt document()

你说的曾经没有我的故事 提交于 2019-12-20 02:56:41
问题 In my xslt I'd like to look up an xml file. I need to pass the path to this file from java code.I have the followings: ... Transformer transformer = TRANSFORMER_FACTORY.newTransformer(); transformer.setParameter("mypath", "/home/user/repository"); xslt: <?xml version="1.0"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:param name="mypath"/> ... <xsl:template match="connection[@id]"> <xsl:variable name="lookupStore"

Why replace one attribute by element is valid, and two attributes not?

旧街凉风 提交于 2019-12-19 11:47:33
问题 In a identity transform we can delete an attribute by <xsl:template match="@myAttrib"/> this works for any input... And we can "replace" the attribute by an element with <xsl:template match="@myAttrib"><b>my new element</b></xsl:template> ... but it works only when input have only one attribute. By other hand, if I need to replace attribute's value, the xsl:template behaviour is the same, that is, <xsl:template match="@myAttrib">newValue</xsl:template> not replaces the value, but delete

How to convert groups of XML elements to JSON lists?

风流意气都作罢 提交于 2019-12-19 10:44:27
问题 Is it possible to apply a template that only matchings on the unique attributes? <node name="region">1</node> <node name="region">2</node> <node name="region">3</node> <node name="place">a</node> <node name="place">b</node> <node name="title">test</node> I want to execute a template once for @name="region" and once for @name="place" . Can this be done using XSLT/XPath 1.0? My ultimate goal is JSON output that looks like this: "container":{ "region":["1","2","3"], "place":["a","b"], "title":

Shifting row data in xsl 1.0

五迷三道 提交于 2019-12-19 10:22:13
问题 I have multiple Rows data in my XML like this - <ROW TYPE="SPECIFICATION" ID="1"> <R1>English1</R1> </ROW> <ROW TYPE="SPECIFICATION" ID="1"> <R1>Maths1</R1> </ROW> <ROW TYPE="TOTAL" ID="1"> <R1>Code1</R1> </ROW> <ROW TYPE="SPECIFICATION" ID="2"> <R1>English2</R1> </ROW> <ROW TYPE="SPECIFICATION" ID="2"> <R1>Maths2</R1> </ROW> <ROW TYPE="TOTAL" ID="2"> <R1>Code2</R1> </ROW> I want my Output to be displayed in Image like that this ROW data works in a for-each loop. And the requirement is that

How to compare strings with Xpath 1.0?

青春壹個敷衍的年華 提交于 2019-12-19 07:17:07
问题 I am experiiencing an issue with the < operator on strings in Xpath 1.0. This simple Xpath expression 'A' < 'B' (or the equivalent 'A' < 'B') did not evaluate to true in my xslt run in libxslt (which is an XSLT 1.0 engine). I checked in XML Spy, which allows testing Xpath expressions in both 1.0 and 2.0, and sure enough, in Xpath 2.0 it evaluates to true , but in Xpath 1.0 it evaluates to false ! Is this a bug in Xpath 1.0? What other expression should I use to compare two strings/characters

Padding number with leading zeros in XSLT 1.0

扶醉桌前 提交于 2019-12-19 06:39:09
问题 We have a number in XML that can go up to 3 digits in a large XML file that has to be converted to fixed length text for loading into another system. I need to pad this with leading zeros to a length of 15 in the output (which is fixed length text) Examples: - 1 becomes 000000000000001 - 11 becomes 000000000000011 - 250 becomes 000000000000250 I tried this: <xsl:value-of select="substring(concat('000000000000000', msg:BankAccount/msg:Counter), 12, 15)"/> to get the 15 zeros at the beginning

Padding number with leading zeros in XSLT 1.0

我是研究僧i 提交于 2019-12-19 06:38:12
问题 We have a number in XML that can go up to 3 digits in a large XML file that has to be converted to fixed length text for loading into another system. I need to pad this with leading zeros to a length of 15 in the output (which is fixed length text) Examples: - 1 becomes 000000000000001 - 11 becomes 000000000000011 - 250 becomes 000000000000250 I tried this: <xsl:value-of select="substring(concat('000000000000000', msg:BankAccount/msg:Counter), 12, 15)"/> to get the 15 zeros at the beginning