xslt-2.0

Can you define a custom collation using a function in XSLT?

杀马特。学长 韩版系。学妹 提交于 2020-01-04 11:09:11
问题 I'd like to define an ordering on strings used in a certain element. For example, <class>Senior</class> <class>Junior</class> <class>Sophomore</class> <class>Freshman<class> would describe a reasonable ordering on class. Is there a way using <xsl:sort select='class'> that would sort by the ordering given above? Thanks in advance. 回答1: Have you looked into Saxon's custom collation extensions? For example, <xsl:variable name="rules" select="'< Freshman < Sophomore < Junior < Senior'" /> This

how to handle “<” and “>” in regex in xslt

此生再无相见时 提交于 2020-01-04 07:55:34
问题 I have string in XML, <italic>a</italic> and I am using xsl:analyze-string to extract all italic words with this pattern: "<italic>a</italic>" . I know I can use template match on italic but the requirement here is to match it using regex. I am trying to write the expression like this, (<italic>)[a-z]+</italic> , but the XSLT processor is throwing an error on the opening < tag. Any idea how to handle opening and closing tags in regex? 回答1: You haven't said what your XML source looks like, but

Batch processing tab-delimited files in XSLT

落花浮王杯 提交于 2020-01-04 06:35:26
问题 I have an XML file with a list of 92 tab-delimited text files: <?xml version="1.0" encoding="UTF-8"?> <dumpSet> <dump filename="file_one.txt"/> <dump filename="file_two.txt"/> <dump filename="file_three.txt"/> ... </dumpSet> The first row in each file contains the field names for the subsequent rows. This is just an example. The names and number of elements will vary by record. Most will have around 50 field names. Title Translated Title Watch Video Interviewee Interviewer Interview with

Batch processing tab-delimited files in XSLT

大兔子大兔子 提交于 2020-01-04 06:34:12
问题 I have an XML file with a list of 92 tab-delimited text files: <?xml version="1.0" encoding="UTF-8"?> <dumpSet> <dump filename="file_one.txt"/> <dump filename="file_two.txt"/> <dump filename="file_three.txt"/> ... </dumpSet> The first row in each file contains the field names for the subsequent rows. This is just an example. The names and number of elements will vary by record. Most will have around 50 field names. Title Translated Title Watch Video Interviewee Interviewer Interview with

Alphanumeric sort on mixed string value revisited

試著忘記壹切 提交于 2020-01-04 02:29:06
问题 Note that I posed a very similar question earlier but the requirements have since changed Alphanumeric sort on mixed string value The primary difference in the requirements now is that the source XML can include forms with all alpha chars in the form_name or all integers. The form_name can be open season as letters and numbers can be in any order: XX ## ## XX XX ## XX XX ### XX XX ## ## XX ### XX XXXX ## XXX XXX### XXX ### Given XML of: <forms> <FORM lob="BO" form_name="AI OM 10"/> <FORM lob=

Alphanumeric sort on mixed string value revisited

非 Y 不嫁゛ 提交于 2020-01-04 02:29:05
问题 Note that I posed a very similar question earlier but the requirements have since changed Alphanumeric sort on mixed string value The primary difference in the requirements now is that the source XML can include forms with all alpha chars in the form_name or all integers. The form_name can be open season as letters and numbers can be in any order: XX ## ## XX XX ## XX XX ### XX XX ## ## XX ### XX XXXX ## XXX XXX### XXX ### Given XML of: <forms> <FORM lob="BO" form_name="AI OM 10"/> <FORM lob=

XSLT function returns different results [Saxon-EE vs Saxon-HE/PE]

橙三吉。 提交于 2020-01-03 08:15:14
问题 I am currently working on a pure XSL-Transformation with Saxon-Processor in various versions. Below is my short stylesheet, simplified for the needs of my question: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:foo="bar"> <xsl:output encoding="UTF-8" method="text"/> <xsl:template match="/"> <xsl:text>Call of func_1: </xsl:text> <xsl:value-of select="foo:func_1()"/> <xsl

XSLT function returns different results [Saxon-EE vs Saxon-HE/PE]

六月ゝ 毕业季﹏ 提交于 2020-01-03 08:14:05
问题 I am currently working on a pure XSL-Transformation with Saxon-Processor in various versions. Below is my short stylesheet, simplified for the needs of my question: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:foo="bar"> <xsl:output encoding="UTF-8" method="text"/> <xsl:template match="/"> <xsl:text>Call of func_1: </xsl:text> <xsl:value-of select="foo:func_1()"/> <xsl

Merging html files using XSLT?

吃可爱长大的小学妹 提交于 2020-01-03 06:37:27
问题 I am transforming multiple html files to one file mean multiple chapters in a book. For that i am recieving text file where is the sequence of file list. While transforming i am not getting the proper sequences of the chapters: TXT FILE: FilePath=d:\Amrendra\edgar xml-html\All\Edger_Final\xml\07_Document_Edgar17Nov.out.indd,d:\Amrendra\edgar xml-html\All\Edger_Final\xml\02_Document_Edgar17Nov.out.indd,d:\Amrendra\edgar xml-html\All\Edger_Final\xml\03_Document_Edgar17Nov.out.indd,d:\Amrendra

XSLT transformation not retaining the attributes

你。 提交于 2020-01-03 05:33:09
问题 We have the following XML that we need to find and replace the path in src attribute parameters <?xml version="1.0"?> <ul> <font> test sample font test </font> <img src="/assets/rep/myimage.png"> test</img> <img src="/assets/rep/myimage.png" height="20px"> test</img> </ul> My XSLT is as follows <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- remove disallowed elements but keep its children --> <xsl:template match=