Tag: xslt

[ANSWERED] xml – Retain trailing zeros after multiplication XSLT

Solution 1 : The picture string of format-number() can be calculated. Consider the following example: XML <input> <multiplicand>1</multiplicand> <multiplicand>2.0</multiplicand> <multiplicand>3.14</multiplicand> <multiplicand>4.000</multiplicand> <multiplicand>5.0000</multiplicand> <multiplicand>6.12345</multiplicand> <multiplicand>7.000000</multiplicand> </input> XSLT <xsl:stylesheet version="2.0" xmlns_xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output…

[ANSWERED] html – XSLT apply-templates in for-each

Solution 1 : Use <xsl:for-each select="following-sibling::*[generate-id(preceding-sibling::h2[1]) = $title and not(self::h2)]"> <xsl:apply-templates select="."/> </xsl:for-each> or simply <xsl:apply-templates select="following-sibling::*[generate-id(preceding-sibling::h2[1]) = $title and not(self::h2)]"/> to process those elements you want to wrap into…

[ANSWERED] xml – Simple unflattening HTML file through XSL

Solution 1 : This is a classic positional grouping problem. To get you started: <xsl:template match="body"> <body> <xsl:for-each-group select="*" group-starting-with="p[@class='subtitle']"> <xsl:choose> <xsl:when test="@class="subtitle"> <div n="section{position()}"> <head>{.}</head> <xsl:apply-templates select="tail(current-group())"/> </div> </xsl:when>…

[ANSWERED] html – Parse XSLT attribute as an array

Solution 1 : Consider the following example: XML <input mapTo="dropdown" nameId="sampleId" inputDomain="a,b,c,d,e" /> XSLT 2.0 <xsl:stylesheet version="2.0" xmlns_xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="input"> <select id="sampleId"> <xsl:for-each select="tokenize(@inputDomain, ',')">…