xslt-2.0

How to force errors on a <xsl:param> without “select” attribute?

浪尽此生 提交于 2019-12-22 09:46:29
问题 If I use <xsl:param> without specifying a value, the transformer assumes that the value is an empty string. In other words, if I forgot to specify a value (e.g. <xsl:param name="N"/> ), the compiler doesn't signal an error. This may cause my program to fail silently, which is a bad thing. How can I specify that my <xsl:param> must have an explicit value ? For example, this code should give me an error because there is no explicit value specified: <?xml version="1.0" encoding="UTF-8"?> <xsl

how to convert xslt version 2.0 to version 1.0

老子叫甜甜 提交于 2019-12-22 08:34:46
问题 i am using xslt document which uses xpath version 2 functions. I only have xalan 2.6 jar which has xslt 1.0 processor, its a constraint i cannot change it..please help me if there are any tools that convert xpath 2.0 functions to 1.0 <xsl:variable name="var1_ClinicalDocument" as="node()?" select="ns0:ClinicalDocument"/> <DSMessage> <DSPatient> <xsl:for-each select="$var1_ClinicalDocument[fn:exists(ns0:id/@root)]"> <Source> <xsl:sequence select="fn:string(ns0:id/@root)"/> </Source> </xsl:for

Using XSLT 2.0 to parse the values of multiple attributes into an array-like structure

≡放荡痞女 提交于 2019-12-22 08:15:37
问题 I'd like to be able to select all the attributes of a certain type in a document (for example, //@arch) and then take that node set and parse the values out into second node set. When I say "parse", in specific I mean I want to turn a node set like this: arch="value1;value2;value3" arch="value1:value4" into a node set like this: arch="value1" arch="value2" arch="value3" arch="value1" arch="value4" or something like that; I want to get the individual values out of the attributes and into their

List of XSLT instructions/functions that change the context node?

喜你入骨 提交于 2019-12-22 03:36:32
问题 Does anyone know of a list of XSLT instructions/functions that change the context node? For example, instruction like for-each is one of them. 回答1: The obvious XSLT 2.0 instructions that change the context are for-each , apply-templates , for-each-group , and analyze-string . But there's also, for example, xsl:sort and xsl:key . In XPath, the operators / and [] change the context. There are no functions that change the context. 回答2: There are only two things in XSLT 1.0 that change the

retrieving XML value dynamically using XSL function

牧云@^-^@ 提交于 2019-12-22 01:12:50
问题 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

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

旧街凉风 提交于 2019-12-21 21:22:57
问题 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

XSLT - Check if pattern exists in an element string

浪尽此生 提交于 2019-12-21 20:38:09
问题 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

How to change Apache FOP Xalan XSLT Processor?

天涯浪子 提交于 2019-12-21 16:57:30
问题 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. 回答1: 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

How to get maximum value under same node in xslt

核能气质少年 提交于 2019-12-21 07:34:32
问题 I have a xml like below : <Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Name>HourlyReport</Name> <Id>8</Id> <TotalResults>1</TotalResults> <TotalPages>1</TotalPages> <Items> <Item> <Id>1</Id> <Hour0>23</Hour0> <Hour1>12</Hour1> <Hour2>7</Hour2> <Hour3>18</Hour3> <Hour4>32</Hour4> . . . <Hour20>28</Hour20> <Hour21>39</Hour21> <Hour22>51</Hour22> <Hour23>49</Hour23> </Item> </Items> </Report> i Need maximum value from above XML

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

时光毁灭记忆、已成空白 提交于 2019-12-21 05:13:24
问题 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!"/>