xslt-2.0

retrieving XML value dynamically using XSL function

。_饼干妹妹 提交于 2019-12-04 20:41:45
my input xml file looks like <root> <sub> <element1 value="abc"/> <element2 value="123"/> </sub> <sub1> <element1 value="ert"/> <element2 value="abc"/> </sub1> </root> i need an XSLT function which reads below XML file and pulls the xpath expression value specified at map/domain/instance/@xpath from above file <map> <domain> <instance xpath="root/sub/element1/@value" length="2"/> </domain> <domain> <instance xpath="root/sub1/element2/@value" length="3"/> </domain> </map> I need a xslt function which checks the length specified for each xpath expression against the incoming xml file. if it

Two phase transformation using XSLT 2.0

前提是你 提交于 2019-12-04 18:58:57
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</column> <column name="price">23195</column> <column name="inventory">54</column> </row> <row> <column name

XSLT - Creating Dynamic Grid

时间秒杀一切 提交于 2019-12-04 17:40:44
I am creating dynamic table(grid) using xslt, XSLT : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:key name="RowAttribsByName" match="Row/@*" use="concat(generate-id(..), '|', name())"/> <xsl:variable name="vColNames" select= "/*/Columns/*[not(@Hidden = 'true')]/@Name"/> <xsl:template match="/*"> <table border="1"> <tr> <xsl:apply-templates select="Columns/*"/> </tr> <xsl:apply-templates select="Rows/Row"/> </table> </xsl:template> <xsl:template match="Column[not(@Hidden = 'true')]"> <td><xsl:value-of

XSLT - Check if pattern exists in an element string

末鹿安然 提交于 2019-12-04 16:58:08
I have the following element as part of a larger XML <MT N="NonEnglishAbstract" V="[DE] Deutsch Abstract text [FR] French Abstract text"/> I need to do some formatting of the value in @V attribute, only if it contains anything like [DE], [FR] or any two capital letters representing a country code within square brackets. If no such pattern exist, I need to simply write the value of @V without any formatting. I can use an XSLT 2.0 solution I was hoping that I could use the matches() function something like <xsl:choose> <xsl:when test="matches(@V,'\[([A-Z]{{2}})\]([^\[]+'"> //Do something </xsl

Transforming numbers to Roman numbers by transforming an XML file via XSLT

隐身守侯 提交于 2019-12-04 16:53:17
I have the following xml input: <root> <calc> <arab>42</arab> </calc> <calc> <arab>137</arab> </calc> </root> I want to output the following: <root> <calc> <roman>XLII</roman> <arab>42</arab> </calc> <calc> <roman>CXXXVII</roman> <arab>137</arab> </calc> </root> By writing a XSLT. So far I wrote this XSLT but what else needs to be done to output the right output? <?xml version="1.0" encoding="UTF-8"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:num="http://whatever" version="2.0" exclude-result-prefixes="xs num"> <xsl:output

xslt 2.0 and Ruby on OS X

蹲街弑〆低调 提交于 2019-12-04 13:10:14
I am attempting to parse an XML document against an XSLT 2.0 sheet. However, I am being told that the libraries on OSX 10.5.x only support XSLT 1.0 operations. When I look at xsltproc, I get this: hmasing$ xsltproc --version Using libxml 20616, libxslt 10112 and libexslt 810 xsltproc was compiled against libxml 20616, libxslt 10112 and libexslt 810 libxslt 10112 was compiled against libxml 20616 libexslt 810 was compiled against libxml 20616 Does anyone have a concise guide to installing XSLT 2.0, the ruby xslt gems to work against those libs, and some good fu to pass my way? Please assume I

Create XSL from XSL

偶尔善良 提交于 2019-12-04 12:49:49
I am trying to dynamically generate an XSLT document from an XSLT stylesheet. In principle this works, of course, but I do not get the namespaces working. I want to have the generated XSLT elements to be prefixed with "xsl" prefix: <xsl:stylesheet ...> rather than <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"> I played around with namespace="" of xsl:element and with xsl:namespace but I do not get it working (xslt2/saxon available) Any hints? If you want to use XSLT to create XSLT code then using http://www.w3.org/TR/xslt20/#element-namespace-alias helps e.g. <xsl:stylesheet version

Meaning of “context” in regard to parameters of a calling template

浪尽此生 提交于 2019-12-04 10:16:13
I like to think that I have a good grasp of XSLT, but the following eludes me: Why is an xsl:param not accessible from a called template that does not explicitly declare it? In other words, if I call template B from template A: Stylesheet 1 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/" name="A"><!--This template is named "A" for convenience only.--> <xsl:param name="hello" select="hello "/> <xsl:param name="world" select="world!"/> <xsl:call-template name="B"/> </xsl:template> <xsl:template name="B"> <xsl:value-of select="concat($hello,

How to change Apache FOP Xalan XSLT Processor?

本小妞迷上赌 提交于 2019-12-04 07:34:11
I am using Apache FOP 1.1.I want to change current apache Xalan XSLT processor to other for supporting XSLT 2.0. Currently it is not supporting XSLT 2.0. Please help me how to solve this problem. thank you. I got my Answer. TransformerFactory has a plug-ability layer. JAXP provides a common Java interface that allows flexibilty to add various implementations of the supported standards XSLT processors. TransformerFactory tFactory = TransformerFactory.newInstance(); This had look-up procedure to locate XSLT processors.AS we does not defined any,it will take available or default. Now, I am adding

How to normalize XML on reverse domain name sorting and custom filtering

你。 提交于 2019-12-04 05:45:24
问题 I've been working on a Geo application. Over the time the product's XML has grown bit messy. The problem arises when synchronizing the changes across multiple environments, like Dev, Test, etc. I'm trying to figure out a way to normalize the content, so I can avoid some cumbersome while editing and merging, and hence, have a productive development. I know it sounds crazy, and there's lot on the background, but let me jump to the actual issue leaving the history. Here's the issue: Multiple