xslt-2.0

Two phase transformation using XSLT 2.0

荒凉一梦 提交于 2019-12-12 09:17:43
问题 I am trying to take a CSV file as input and transform it into a XML. I'm new to XSLT and I've found a way to convert a CSV into XML (using an example from Andrew Welch) like so: Input CSV file: car manufacturer,model,color,price,inventory subaru,outback,blue,23195,54 subaru,forester,silver,20495,23 And my output XML would be: <?xml version="1.0" encoding="UTF-8"?> <rows> <row> <column name="car manufacturer">subaru</column> <column name="model">outback</column> <column name="color">blue<

How to use xpath for variable in xslt?

不羁岁月 提交于 2019-12-12 07:22:22
问题 for example, I have a variable $myVar which equal to: <ResultSet> <Row> <Cell name="NEXTVAL" type="NUMBER">475535</Cell> </Row> <Row> <Cell name="NEXTVAL" type="NUMBER">475536</Cell> </Row> <Row> <Cell name="NEXTVAL" type="NUMBER">475537</Cell> </Row> </ResultSet> How I can use xpath for this variable in xslt? Like somehow get value in /ResultSet/Row[1]/Cell 回答1: If your variable is formed like this <xsl:variable name="myVar" as="element()"> <ResultSet> <Row> <Cell name="NEXTVAL" type="NUMBER

How to add element to XML via XSL

坚强是说给别人听的谎言 提交于 2019-12-12 06:52:46
问题 I have created a simple XSL file which performs transformation on XML file. Now the transformation returns True or False (depending on the result of the test) if passed = true, fail = false. Now i want to add extra tag into my XML with this values I have seen this post and tried to adapt this into my problem however it didn't quite work. My xml file initially looks like this <?xml version="1.0" encoding="iso-8859-1"?> <message> <unique-id>unique-id</unique-id> <payload> <Envelope xmlns:xsi=

How to process a sequence with one or more items

旧城冷巷雨未停 提交于 2019-12-12 06:23:35
问题 I have a XSLT stylesheet that transforms a plain text notation to SVG. It works just fine, but it is only possible to process a symbol with one item. This works for example: GRAPHREP PEN color:$000000 w:2pt FILL color:$ff7f00 ELLIPSE x:0pt y:0pt rx:50pt ry:50pt When I want to transform a symbol with more than one items like this, GRAPHREP PEN color:$000000 w:2pt FILL color:$ff7f00 ELLIPSE x:0pt y:0pt rx:50pt ry:50pt PEN color:$000000 w:2pt FILL color:$ff7f00 ELLIPSE x:0pt y:0pt rx:30pt ry

Adding namespace in inner parent group in xslt v2.0

倾然丶 夕夏残阳落幕 提交于 2019-12-12 06:13:14
问题 I tried all the codes I've seen in the internet with relevant requirement as I have. However, in my case, I also need to populate the namespace within the inner parent group. My XSLT didn't work as expected. Can anyone help me with this? Thank you. XSLT CODE: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/>

is there a way to check if there is text between the nodes

偶尔善良 提交于 2019-12-12 05:36:27
问题 I've the below 2 different XML Cases. Case1 <para><content-style font-style="bold">1/3</content-style> This is text</para> Case2 <para>This is text <content-style font-style="bold">1/3</content-style></para> i'm using the template match as below <xsl:template match="para[content-style[matches(., '(\w+)/(\w+)')]]"> but as per this match, both the cases mentioned above are satisfied, i want only first case to be caught ignoring the second case. please let me know how can i get this done. Thanks

Correlating related items using XSLT

落爺英雄遲暮 提交于 2019-12-12 05:26:40
问题 I have the following xml input, <Adult> <Parent> <Id>1</Id> <Name>Nick</Name> <Age>32</Age> </Parent> <Parent> <Id>2</Id> <Name>Michael</Name> <Age>35</Age> </Parent> <Information xmlns="http://ws.apache.org/ns/synapse" xmlns:ns="www.abc.com"> <Children xmlns=""> <Child> <Name>Anne</Name> <Gender>Female</Gender> <ParentId>1</ParentId> </Child> <Child> <Name>Will</Name> <Gender>Male</Gender> <ParentId>1</ParentId> </Child> <Child> <Name>Carney</Name> <Gender>Female</Gender> <ParentId>2<

XSLT 2.0: using a regular expression to extract all matching parts to an array

安稳与你 提交于 2019-12-12 05:25:43
问题 How can I collect all parts of a string matching a regular expression pattern into an array? <xsl:variable name="matches" select="function('abc_Xza_Y_Sswq', '_[A-Z]')"/> returning ('_X', '_Y', '_S') 回答1: There are no arrays in XSLT/XPath 2.0, you could however write a function that uses analyze-string to return a sequence of strings: <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.com/mf"

XPath and min function not recognized in xslt

两盒软妹~` 提交于 2019-12-12 04:44:42
问题 <td class="num"> <xsl:if test="min(//vrednostDelnice)=trgovalniPodatki/vrednostDelnice"> <xsl:attribute name="class">red</xsl:attribute> </xsl:if> <xsl:if test="max(//vrednostDelnice)=trgovalniPodatki/vrednostDelnice"> <xsl:attribute name="class">green</xsl:attribute> </xsl:if> <xsl:value-of select="format-number(trgovalniPodatki/vrednostDelnice, '#.###,00 €', 'euro')"/> </td> but I get This document had an invalid XSLT stylesheet. Error message from the XSLT engine: Error: XPath expression

xml search and replace xsl errors

拜拜、爱过 提交于 2019-12-12 04:19:21
问题 <?xml version="1.0" encoding="UTF-8"?> <TABLE NAME="less.db"> <DATA RECORDS="233673"> <RECORD ID="1"> <ID>1</ID> <ROW>0</ROW> <DATE>19/9/2003 12:31:54 μμ</DATE> <al>29/6/2005 10:46:42 πμ</al> <KIT>46123</KIT> <KAP>08</KAP> <YTE>A.IV.C.54</YTE> <HTE>0</HTE> <HEN>0</HEN> <SUM>0</SUM> <LYW>0</LYW> <AMF>29</AMF> <MANUFACTURER>ASUS</MANUFACTURER> <AME>pan</AME> </RECORD> <RECORD ID="1"> <ID>1</ID> <ROW>0</ROW> <DATE>19/9/2003 12:31:54 μμ</DATE> <al>29/6/2005 10:46:42 πμ</al> <KIT>46123</KIT> <KAP