xslt-2.0

how to convert xslt version 2.0 to version 1.0

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 16:48:06
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-each> <Demographics> <xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0

XSLT2: How to reference attributes about the current node in XPath2 predicates

左心房为你撑大大i 提交于 2019-12-05 16:32:51
I had posted another question with this as one aspect of it. I was told to clarify the question, but that question was already pretty long and complicated, so I created a new one. I want to know if there is standard way of referencing the current node's attribute in an XPath expression testing for another one. For an example, consider the following XSLT <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="potato/stem[eye]"> In session <xsl:value-of select="@sessionID"/>, the potato

How to split text and preserve HTML tags (XSLT 2.0)

有些话、适合烂在心里 提交于 2019-12-05 15:57:59
I have an xml that has a description node: <config> <desc>A <b>first</b> sentence here. The second sentence with some link <a href="myurl">The link</a>. The <u>third</u> one.</desc> </config> I am trying to split the sentences using dot as separator but keeping in the same time in the HTML output the eventual HTML tags. What I have so far is a template that splits the description but the HTML tags are lost in the output due to the normalize-space and substring-before functions. My current template is given below: <xsl:template name="output-tokens"> <xsl:param name="sourceText" /> <!-- Force a

xsl:character-map to replace special characters

大城市里の小女人 提交于 2019-12-05 14:37:06
Given an element with a value of: <xml_element>Distrib = SU & Prem &lt;&gt; 0</xml_element> I need to turn &lt; or &gt; into < or > because a downstream app requires it in this format throughout the entire XML document. I would need this for quotes and apostrophes too. I am tryinging a character-map in XSLT 2.0. <xsl:character-map name="specialchar"> <xsl:output-character character="&apos;" string="&apos;" /> <xsl:output-character character=""" string="&quot;" /> <xsl:output-character character=">" string="&gt;" /> </xsl:character-map> The <xsl:character-map> instruction can be used to

How to wrap text to fit window in XSLT

泄露秘密 提交于 2019-12-05 11:27:13
I am extracting data from XML using XSLT 2.0. The data has long lines and I want to fit them into window size by automatically breaking lines. Is it possible in XSLT? You can use the standard XSLT 2.0 function unparsed-text() to read a text file directly in your XSLT 2.0 code. Then just use : replace(concat(normalize-space($text),' '), '(.{0,60}) ', '$1 ') Explanation : This first normalizes the white space, deleting the leading and trailing sequences of whitespace-only characters and replacing any inner such sequence with a single space. Then the result of the normalization is used as the

Looping over distinct values

只谈情不闲聊 提交于 2019-12-05 08:16:13
Given a variable which returns a list of distinct States using the distinct-values() function, is there a way to tokenize the variable in a for-each loop? <States> <State>AL</State> <State>AL</State> <State>NM</State> </States> The following variable returns AL and NM, but I can't iterate over it using for-each. Is there a way around this? <xsl:variable name="FormStates" select="distinct-values(States/State)"/> <xsl:for-each select="$FormStates"> XSLT 2.0 ok. The distinct-values() function returns a sequence of values which you should be able to iterate over. The result is so to speak

Assign to <xsl:variable> after thedecleration

醉酒当歌 提交于 2019-12-05 06:48:04
I am using the below way to assign value to a variable. <xsl:variable name="NewValue"> <xsl:value-of select="normalize-space(//root/id/amount)"/> </xsl:variable> After the assignment I want to assign new value to the same variable. Like this:- <xsl:variable name="NewValue" select="normalize-space(//root/id/amountnew)"> Is there any way for this? Here the sample of XML that I have: <VolLien> <Vest_DocType>SDD</Vest_DocType> <Vest_Instrument>395072</Vest_Instrument> <Vest_OfOfficialEntity>eee</Vest_OfOfficialEntity> <Vest_RecDate>12/24/2009</Vest_RecDate> <Vest_Grantee1>abc dd</Vest_Grantee1>

How to handle the illegal HTML characters in XSL

╄→尐↘猪︶ㄣ 提交于 2019-12-05 06:13:43
I have an XML file which stores data. I am using an XSL to generate HTML files from that XML file. When I try to do that I get the error Illegal HTML character: decimal 150 I am not allowed to change the XML file. I have to map that one and many other illegal characters to a legal character (it can be any) in XSL. So it has to do that mapping in a generic way not only for one type of character. You can define a character map that maps the characters not allowed to one allowed, for instance a space: <xsl:output indent="yes" method="html" use-character-maps="m1"/> <xsl:character-map name="m1">

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

℡╲_俬逩灬. 提交于 2019-12-04 23:52:12
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. Michael Kay 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. There are only two things in XSLT 1.0 that change the context and neither of them are functions. These are: <xsl:apply-templates select='some-test'/> (which will

How to update the variable value in xslt?

旧街凉风 提交于 2019-12-04 22:52:50
I have declared a variable in my .xsl file. Now I want to update the older value with new value. For example: <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <Document> <xsl:variable name="topLevelHeadings" select = "//w:body/w:p[w:pPr[w:pStyle[@w:val='Heading1']]]"/> <xsl:variable name="beforeHeading" select="false()"/> <xsl:choose> <xsl:when test="$beforeHeading"> <xsl:apply