xslt-2.0

Convert HTML colspan and rowspan to “empty” cells

一曲冷凌霜 提交于 2020-01-03 04:37:06
问题 For a certain output format ( not HTML-like), I need to convert HTML tables to 'square' tables, where each colspan and rowspan is not only indicated in the parent cell, but also followed by the correct number of empty cells. For example, the simple HTML table <table> <tr> <th>test</th> <th colspan="2">span 1/2</th> <th colspan="3">span 2/2</th> </tr> <tr> <td>col 1</td> <td>col 2</td> <td>col 3</td> <td>col 4</td> <td>col 5</td> <td>col 6</td> </tr> </table> should be translated to <table>

Alphanumeric sort on mixed string value

梦想与她 提交于 2020-01-03 04:15:08
问题 Given XML snippet of: <forms> <FORM lob="BO" form_name="AI OM 10"/> <FORM lob="BO" form_name="CL BP 03 01"/> <FORM lob="BO" form_name="AI OM 107"/> <FORM lob="BO" form_name="CL BP 00 02"/> <FORM lob="BO" form_name="123 DDE"/> <FORM lob="BO" form_name="CL BP 00 02"/> <FORM lob="BO" form_name="AI OM 98"/> </forms> I need to sort the FORM nodes by form_name alphabetically so all the forms containing 'AI OM' in the form_name are grouped together and then within that they are in numeric order by

How to read the processing-instructions properties?

霸气de小男生 提交于 2020-01-03 01:47:26
问题 I have processing-instructions in XML. How can I get the id value in processing-instruction when we apply the <xsl:template match="Dest" > <?abc ?abc:Dest id="e47529cb-4d17-461b-8438-e3b6d9ec1a68"??> </xsl:template> 回答1: The solution is: INPUT: <abc> <?abc ?abc:Dest id="e47529cb-4d17-461b-8438-e3b6d9ec1a68"??> </abc> XSLT: <?xml version='1.0' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="processing-instruction('abc')"> <P-I><xsl:value

Grouping and sorting XSLT by key and position()

可紊 提交于 2020-01-02 20:30:32
问题 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">

How to handle the illegal HTML characters in XSL

江枫思渺然 提交于 2020-01-02 03:25:08
问题 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. 回答1: You can define a character map that maps the characters not allowed to one allowed, for

fixed: Multiple page-sequence objects

自闭症网瘾萝莉.ら 提交于 2020-01-01 19:27:01
问题 When working with big xml files fop breaks down due to the lack of ram(1.7gb in my case, is the limit), so one of the ways to fix this is to use multiple page sequence objects as described here . However the are no description how to use them... And what I tried to do is to "create" a new page sequence objects using for-each, but it seems that I have failed and fob breaks down when it reaches 1.7gb of ram anyways <xsl:template match="OurForm"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL

Use xslt:analyze-string to add acronyms to HTML

余生颓废 提交于 2020-01-01 14:22:32
问题 I want to add acronyms to an HTML text using xslt:analyze-string. The problem: in my HTML text are tags such as <strong>some text</strong> that are treated as XML nodes. When I apply xslt:analyze-string these nodes are converted to strings - the tags are stripped away. Also in my recursive XSLT stylesheet the acronyms that are already inserted are stripped away, too. My question: is there a trick to prevent xslt:analyze-string of transforming the HTML nodes to strings and preserve the HTML

Merge different products belong to each standard

家住魔仙堡 提交于 2019-12-31 04:13:18
问题 I have to transform the following xml content, <Standards xmlns="http://ws.wso2.org/dataservice"> <Standard> <ProductID>200057</ProductID> <Prefix>ISO</Prefix> <SNumber>1001</SNumber> <DraftProducts> <RelatedProduct> <ProductID>1500163</ProductID> </RelatedProduct> </DraftProducts> <ReferenceProducts> <RelatedProduct> <ProductID>263973</ProductID> <RelationId>708519</RelationId> <Designation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> </RelatedProduct>

XSL transform on text to XML with unparsed-text: need more depth

寵の児 提交于 2019-12-31 02:10:20
问题 My rather well-formed input (I don't want to copy all data): StartThing Size Big Colour Blue coords 42, 42 foo bar EndThing StartThing Size Small Colour Red coords 29, 51 machin bidule EndThing <!-- repeat a few thousand times--> I have the below XSL which I modified from Parse text file with XSLT <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"> <xsl:output indent="yes"/> <xsl:strip-space

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

試著忘記壹切 提交于 2019-12-30 10:42:27
问题 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