xslt-2.0

How to Import stylesheets in xslt conditionally?

自古美人都是妖i 提交于 2019-12-01 17:41:48
问题 Is there any way to import stylesheets after checking some conditions? Like,if the value of variable $a="1" then import 1.xsl or else import 2.xsl. 回答1: Hi All, Is there any way to import stylesheets after checking some conditions? Like,if the value of variable $a="1" then import 1.xsl or else import 2.xsl. No, the <xsl:import> directive is only compile-time . In XSLT 2.0 one can use the use-when attribute for a limited conditional compilation. For example : <xsl:import href="module-A.xsl"

How to find a word within text using XSLT 2.0 and REGEX (which doesn't have \\b word boundary)?

℡╲_俬逩灬. 提交于 2019-12-01 13:12:05
I am attempting to scan a string of words and look for the presence of a particular word(case insensitive) in an XSLT 2.0 stylesheet using REGEX. I have a list of words that I wish to iterate over and determine whether or not they exist within a given string. I want to match on a word anywhere within the given text, but I do not want to match within a word (i.e. A search for foo should not match on " foo d" and a search for bar should not match on "re bar "). XSLT 2.0 REGEX does not have a word boundary( \b ), so I need to replicate it as best I can. You can use alternation to avoid repetition

Creating parent-child elements from semantic hiearchy in element values in XSLT 2

試著忘記壹切 提交于 2019-12-01 10:31:33
I have a series of P tags in XML content that have a semantic hierarchy within their beginning values, however, the P tags are linear. Looking for the XSLT 2 transformation. Semantic hierarchy is as follows: (1) +-(a) +-(I) +-(A) With RegEx sequence as follows: <xsl:param name="patternOrder" as="element(pattern)*" xmlns=""> <pattern level="1" value="^(\([0-9]+(\.[0-9]+)?\))" /> <pattern level="2" value="^(\([a-z]\))" /> <pattern level="3" value="^(\((IX|IV|V?I{{0,3}})\))" /> <pattern level="4" value="^(\([\w]+(\.[\w]+)?\))" /> </xsl> After review of my dataset, I have the various conditions: <

Doing a double-pass in XSL?

六月ゝ 毕业季﹏ 提交于 2019-12-01 08:21:20
Is it possible to store the output of an XSL transformation in some sort of variable and then perform an additional transformation on the variable's contents? (All in one XSL file) (XSLT-2.0 Preferred) XSLT 2.0 Solution : <xsl:variable name="firstPassResult"> <xsl:apply-templates select="/" mode="firstPass"/> </xsl:variable> <xsl:template match="/"> <xsl:apply-templates select="$firstPassResult" mode="secondPass"/> </xsl:template> The trick here, is to use mode="firstPassResult" for the first pass while all the templates for the sedond pass should have mode="secondPass". Edit: Example : <root>

Doing a double-pass in XSL?

穿精又带淫゛_ 提交于 2019-12-01 07:41:06
问题 Is it possible to store the output of an XSL transformation in some sort of variable and then perform an additional transformation on the variable's contents? (All in one XSL file) (XSLT-2.0 Preferred) 回答1: XSLT 2.0 Solution : <xsl:variable name="firstPassResult"> <xsl:apply-templates select="/" mode="firstPass"/> </xsl:variable> <xsl:template match="/"> <xsl:apply-templates select="$firstPassResult" mode="secondPass"/> </xsl:template> The trick here, is to use mode="firstPassResult" for the

How to show page number (N of N) using xslt in PDF Report

孤街醉人 提交于 2019-12-01 03:13:53
I am using XSLT to generate PDF report. My requirements are to display page number in the format of Page N of N (e.g.Page 1 of 3) at the footer of the report. For static values it works fine and it repeats on each page. As total number of pages in the report are not known and it changes run time, so how I will accomplish this task. My XSLT code snippet <xsl:template name="footerall"> <xsl:variable name="maxwidth" select="7.07000" /> <fo:static-content flow-name="xsl-region-after"> <fo:block> <xsl:variable name="tablewidth29" select="$maxwidth * 1.00000" /> <xsl:variable name="sumcolumnwidths29

How to show page number (N of N) using xslt in PDF Report

痞子三分冷 提交于 2019-11-30 23:10:28
问题 I am using XSLT to generate PDF report. My requirements are to display page number in the format of Page N of N (e.g.Page 1 of 3) at the footer of the report. For static values it works fine and it repeats on each page. As total number of pages in the report are not known and it changes run time, so how I will accomplish this task. My XSLT code snippet <xsl:template name="footerall"> <xsl:variable name="maxwidth" select="7.07000" /> <fo:static-content flow-name="xsl-region-after"> <fo:block>

Memory efficient XSLT for transforming large XML files

空扰寡人 提交于 2019-11-30 22:54:51
This question is related to a recent answer by michael.hor257k , which is in-turn related to an answer by Dimitre Novatchev . When used the stylesheet in the above mentioned answer(by michael.hor257k ), for a large XML(around 60MB, sample XML is present below) and the transformation was carried out successfully. When tried another stylesheet, a little different from michael.hor257k's, and is intended to group elements(with a child sectPr ) and their following-siblings(until the next following-sibling element with a child sectPr ), recursively(i.e., group the elements to the depth of the input

Memory efficient XSLT for transforming large XML files

心已入冬 提交于 2019-11-30 17:28:02
问题 This question is related to a recent answer by michael.hor257k , which is in-turn related to an answer by Dimitre Novatchev . When used the stylesheet in the above mentioned answer(by michael.hor257k ), for a large XML(around 60MB, sample XML is present below) and the transformation was carried out successfully. When tried another stylesheet, a little different from michael.hor257k's, and is intended to group elements(with a child sectPr ) and their following-siblings(until the next following

To compare two elements(string type) in XSLT?

安稳与你 提交于 2019-11-30 17:20:54
i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: <OU_NAME>Vision Operations</OU_NAME> --XML code <OU_ADDR1>90 Fifth Avenue</OU_ADDR1> --XML code <xsl:choose> <xsl:when test="OU_NAME='OU_ADDR1'"> --comparing two elements coming from XML <!--remove if adrees already contain operating unit name <xsl:value-of select="OU_NAME"/> <fo:block/>--> <xsl:if test="OU_ADDR1 !='' "> <xsl:value-of select="OU_ADDR1"/> <fo:block/> </xsl:if> <xsl:if test="LE_ADDR2 !='' "> <xsl:value-of select="OU_ADDR2"/> <fo:block/> </xsl:if> <xsl:if