xslt-3.0

How to pick value of multiple nodes and test it in a single condition?

给你一囗甜甜゛ 提交于 2021-02-11 06:51:31
问题 In continuation to this post, I have restructured the code to better understand my requirement. I have also provided more detail to it. XML FILE <Person> <Name>Kavya</Name> <Gift> <ItemName>PD1</ItemName> </Gift> <Gift> <ItemName>PS1</ItemName> </Gift> <Gift> <ItemName>PD2</ItemName> </Gift> </Person> Now, In the above structure, I need to return a text Successfull only when the Person has a Gift with ItemName that is empty or has only PS1 and not PD1 or PD2 . So, when writing an XSLT file, I

A better way to use streaming in XSLT 3.0

可紊 提交于 2021-01-29 13:58:55
问题 A document I am trying to transform using streaming have the structure as follows <Document> <Header> <Number>23</Number> <Type>3</Type> </Header> <Lines> <Line> <LineNumber>1</LineNumber> </Line> <Line> <LineNumber>2</LineNumber> </Line> </Lines> <Summary> <Total>42</Total> </Summary> </Document> The real output should have more complex structure, but for the moment I simplified it to just having a different naming <Transformed> <DocumentHeader> <DocumentNumber>23</DocumentNumber>

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

How to use XSLT 3.0 using Saxon-HE 9.8 in .NET

拜拜、爱过 提交于 2021-01-27 07:04:03
问题 I'm using Win7 and set my VSC# project to .NETFramework4. Then download SaxonHE9-8-0-7N-setup.exe and install. Then reference saxon9he-api.dll to C# project and using Saxon.Api; And here's my program.cs : static void Main(string[] args) { var xslt = new FileInfo(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory.ToString(), @"..\..\..")) + @"\TEST.xslt"); var input = new FileInfo(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory.ToString(), @"..\..\..")) + @"\TEST.xml"); var

Remove certain nodes from an xml using xslt3.0

女生的网名这么多〃 提交于 2021-01-07 02:33:00
问题 Currently i am trying to remove certain nodes from an xml using xslt3.0 using identity template. But this is taking long processing time. need some suggestion to improve performace using Xslt30Transformer. <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="pathexcluded" select="'CATALOG/CD1 | CATALOG/CD2 '"/> <xsl:variable name="changed-nodes" as="node()*" > <xsl

Remove certain nodes from an xml using xslt3.0

跟風遠走 提交于 2021-01-07 02:32:58
问题 Currently i am trying to remove certain nodes from an xml using xslt3.0 using identity template. But this is taking long processing time. need some suggestion to improve performace using Xslt30Transformer. <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="pathexcluded" select="'CATALOG/CD1 | CATALOG/CD2 '"/> <xsl:variable name="changed-nodes" as="node()*" > <xsl

XPath 3.1 in XSL-T 3.0 How to parse free format String to DateTime as in java.text.SimpleDateFormat?

早过忘川 提交于 2021-01-06 06:04:06
问题 I would like to parse almost free format String to DateTime in XSL-T 3.0 as one can do it in Java using java.text.SimpleDateFormat. Is it possible? I am using the latest Saxon HE 9.7.0.1 for Java and consulting it with the W3C CR 3.1 "XPath and XQuery Functions and Operators 3.1". There is the function "fn:parse-ietf-date" in W3C CR 3.1, but it does not look like it can parse String like "6.1.94 7:29" - the Exception: Error at char 17 in xsl:value-of/@select on line 20 column 47 of tr.xsl:

Add element between two other elements via XSLT?

半腔热情 提交于 2020-12-11 01:02:13
问题 I have the following input XML: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ddd>some string ddd</ddd> </root> Using XSLT I want to the following output: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ccc>some string ccc</ccc> <ddd>some string ddd</ddd> </root> My XSLT is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select=

Add element between two other elements via XSLT?

时光毁灭记忆、已成空白 提交于 2020-12-11 01:00:00
问题 I have the following input XML: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ddd>some string ddd</ddd> </root> Using XSLT I want to the following output: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ccc>some string ccc</ccc> <ddd>some string ddd</ddd> </root> My XSLT is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select=

Add element between two other elements via XSLT?

守給你的承諾、 提交于 2020-12-11 00:49:48
问题 I have the following input XML: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ddd>some string ddd</ddd> </root> Using XSLT I want to the following output: <root> <aaa>some string aaa</aaa> <bbb>some string bbb</bbb> <ccc>some string ccc</ccc> <ddd>some string ddd</ddd> </root> My XSLT is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select=