xslt-1.0

XSLT Validate and Concatenate Multiple Variables

青春壹個敷衍的年華 提交于 2019-12-22 10:53:27
问题 I have to validate and concatenate multiple variable after validating them. <xsl:variable name="val1" select="//xpath"/> <xsl:variable name="val2" select="//xpath"/> <xsl:variable name="val3" select="//xpath"/> <xsl:variable name="val4" select="//xpath"/> <xsl:variable name="val5" select="//xpath"/> Is there any template available for this or anyone can help me doing this. Update from comments I want to concatenate five values like this: Address, Address1, City, State, Zipcode . If Address is

XSLT: How to generate unique id for node based on value only

扶醉桌前 提交于 2019-12-22 10:23:51
问题 I have a source XML that contains address elements which could have the same values (please note that Contact/id=1 and Contact/id=3 have the same address: <?xml version="1.0" encoding="utf-8"?> <Contacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Contact> <id>1</id> <Address> <City City="Wien" /> <Postcode Postcode="LSP-123" /> </Address> </Contact> <Contact> <id>2</id> <Address> <City City="Toronto" /> <Postcode Postcode="LKT-947" /> </Address> </Contact> <Contact> <id>3</id>

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

Converting decimal hours to hours minutes and seconds

家住魔仙堡 提交于 2019-12-22 09:15:20
问题 Is there a more elegant solution to the following in xslt 1.0? I understand there are built in functions to xslt 2.0. I'm taking a number in decimal hours and need to represent it as HH:MM:SS. At the moment I have the following which functions well. <xsl:variable name="decimal_hours" select="pre_lab_cost div pre_labour_rate"/> <xsl:variable name="decimal_minutes" select="number(concat('0.',substring-after($decimal_hours, '.')))*60"/> <xsl:variable name="decimal_seconds" select="number(concat(

Using xslt to parse and then format names

笑着哭i 提交于 2019-12-22 09:08:10
问题 I'm attempting to write an XSLT stylesheet that will handle author's names and create APA versions of the citation. The format for APA citation regarding author's name(s): Names are listed last name, then initials, if name(s) is the first element of the citation. Separate names with a comma, and an ampersand (&) before the last author. I followed Dimitre Novatchev's solution in this post:Using XSLT to select after EACH instance in a string/substring but I'm not getting the results I wanted.

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

How do you move an attribute in the first child of a parent to the parent in XSLT?

蹲街弑〆低调 提交于 2019-12-22 08:27:13
问题 I'm a beginner to XSLT, I'm trying to convert flash Text Format into HTML based format There are <LI></LI> blocks in the source xml and all <LI> blocks contains 1 or many <FONT> nodes. I need to apply the styles of the <FONT> in inline css to the <LI> and remove the <FONT> node (first FONT child). ( Example for explanation only - start ) From: <LI> <FONT FACE="Lato" SIZE="24" COLOR="#F7941D" LETTERSPACING="0" KERNING="0"> <I>ertrr</I> <FONT SIZE="12" COLOR="#4B4B4B">sdfsd</FONT> </FONT> </LI>

find next-to-last node with xpath

我怕爱的太早我们不能终老 提交于 2019-12-22 04:39:17
问题 I have a XML document with chapters and nested sections . I am trying to find, for any section, the first second-level section ancestor. That is the next-to-last section in the ancestor-or-self axis. pseudo-code: <chapter><title>mychapter</title> <section><title>first</title> <section><title>second</title> <more/><stuff/> </section> </section> </chapter> my selector: <xsl:apply-templates select="ancestor-or-self::section[last()-1]" mode="title.markup" /> Of course that works until last()-1

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

XSLT: Reading content that is devided by empty tags

你离开我真会死。 提交于 2019-12-22 00:11:10
问题 So I am busy creating a XSLT file to process various XML documents into a new node layout. There's one thing I can't figure out, here is an example of XML that I'm working with: <page> This is a paragraph on the page. <newParagraph/> This is another paragraph. <newParagraph/> Here is yet another paragraph on this page. <page> As you can see the paragraphs are split up using empty tags as deviders. In the result XML I want this: <page> <p> This is a paragraph on the page. </p> <p> This is