xslt-2.0

I would like to implement a `split function/template` which takes as input a string and a delimiter and returns a split array of the string

不想你离开。 提交于 2019-12-07 21:49:02
问题 I would like to implement a split function/template in XSLT which takes as input a string and a delimiter and returns a split array of the string.. Or rather I'd like the ability to do something along the lines of: <xsl:call-template name="F"> <xsl:with-param name="input" select="'a,b,c,d,e'"/> <xsl:with-param name="replacement"> <option value='$x'>$x</option> </xsl:with-param> </xsl:call-template> which will give me <option value='a'>a</option><option value='b'>b</option><option value='c'>c<

XSLT 2.0 support in JDK 6?

夙愿已清 提交于 2019-12-07 18:09:44
问题 Does JDK 6 support XSLT 2.0 for transformation. My question is, does it come with an XSLT processor built for XSLT 2.0? or DO I need to go for other libraries like Saxon. 回答1: No, it doesn't, not by default anyway. As you suggest, you need to use Saxon or another option would be Oracle's XDK. 来源: https://stackoverflow.com/questions/1599957/xslt-2-0-support-in-jdk-6

How to use XSLT 3.0 from a Java application?

被刻印的时光 ゝ 提交于 2019-12-07 15:22:38
问题 The general java code i use to process XSLT and XML files are : public static final String transformXmlDocument(String inputXmlString, File xsltFile) { TransformerFactory factory = TransformerFactory.newInstance(); StreamSource xslt = new StreamSource(xsltFile); StreamSource text = new StreamSource(new StringReader(inputXmlString)); StringWriter writer = new StringWriter(); StreamResult textOP = new StreamResult(writer); try { Transformer transformer = factory.newTransformer(xslt);

Sorting in XSLT from two xml files

落花浮王杯 提交于 2019-12-07 14:42:16
问题 I have these two xmls 1> default.xml <UI-defination> <class > <list_view > <members> <member col_span="1" name="code" displayName="Code"/> <member col_span="1" name="creationTS" displayName="CreationTS"/> <member col_span="1" name="creator" displayName="Creator"/> <member col_span="1" name="displayName" displayName="DisplayName"/> <member col_span="1" name="emailAddress" displayName="EmailAddress"/> <member col_span="1" name="id" displayName="Id"/> </members> </list_view> </class> </UI

Finding the lowest common ancestor of an XML node-set

寵の児 提交于 2019-12-07 13:22:50
问题 I have a node set constructed using the xsl:key structure in XSLT. I would like to find the lowest common ancestor (LCA) of all of the nodes in this node-set - any ideas? I know about Kaysian intersects and XPath's intersect function, but these seem to be geared towards finding the LCA of just a pair of elements: I don't know in advance how many items will be in each node-set. I was wondering if there might be a solution using a combination of the 'every' and 'intersect' expressions, but I

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

怎甘沉沦 提交于 2019-12-07 07:26:59
问题 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="/

How to wrap text to fit window in XSLT

别等时光非礼了梦想. 提交于 2019-12-07 04:50:02
问题 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? 回答1: 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

Assign to <xsl:variable> after thedecleration

丶灬走出姿态 提交于 2019-12-07 03:48:10
问题 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<

Grouping and sorting XSLT by key and position()

孤街醉人 提交于 2019-12-07 03:44:27
I am trying to display data sorted alphabetically so that items that begin with the same letter are in separate columns. These columns can hold a maximum of 10 items before a new column is started. I can successfully divide the data up alphabetically AND divide it up by number of items per column but I am struggling to combine the 2: Divided alphabetically: <xsl:template match="/"> <xsl:key name="node-by-first-letter" match="node" use="substring(@email, 1, 1)" /> <div class="scroller-panel"> <xsl:for-each select="msxml:node-set($members)/node[count(. | key('node-by-first-letter', substring(

Looping over distinct values

混江龙づ霸主 提交于 2019-12-07 03:25: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. 回答1: The distinct-values()