XPath select all elements between two specific elements
Same concept as bytebuster, but a different xpath: /*/p[count(preceding-sibling::divider)=1]
Same concept as bytebuster, but a different xpath: /*/p[count(preceding-sibling::divider)=1]
<xsl:sequence> on an atomic value (or sequence of atomic values) is the same as <xsl:copy-of> both just return a copy of their input. The difference comes when you consider nodes. If $n is a single element node, eg as defined by something like <xsl:variable name=”n” select=”/html”/> Then <xsl:copy-of select=”$n”/> Returns a copy of the node, … Read more
Adding to jelovirt’s answer, you can use number() to convert the value to a number, then round(), floor(), or ceiling() to get a whole integer. Example <xsl:variable name=”MyValAsText” select=”‘5.14′”/> <xsl:value-of select=”number($MyValAsText) * 2″/> <!– This outputs 10.28 –> <xsl:value-of select=”floor($MyValAsText)”/> <!– outputs 5 –> <xsl:value-of select=”ceiling($MyValAsText)”/> <!– outputs 6 –> <xsl:value-of select=”round($MyValAsText)”/> <!– outputs 5 … Read more
You are right, there is no way in Excel 2007 to get it load both the encoding and the seperator correctly across different locales when someone double clicks a CSV file. It seems like when you specify sep= after the BOM it forgets the BOM has told it that it is UTF-8. You have to … Read more
I. Plain XSLT 1.0 solution: This transformation: <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output omit-xml-declaration=”yes” indent=”yes”/> <xsl:template match=”text()” name=”split”> <xsl:param name=”pText” select=”.”/> <xsl:if test=”string-length($pText)”> <xsl:if test=”not($pText=.)”> <br /> </xsl:if> <xsl:value-of select= “substring-before(concat($pText,’;’),’;’)”/> <xsl:call-template name=”split”> <xsl:with-param name=”pText” select= “substring-after($pText, ‘;’)”/> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> when applied on this XML document: <t>123 Elm Street;PO Box 222;c/o James Jones</t> produces the … Read more
The short answer is “No, use one of the diverse set of browsers out there”. The reason this doesn’t work is due to a security concern that Chrome has addressed in a controversial way[1][2][3][4], by blocking XML files from accessing local XSLT files in the same directory, while HTML files can access .CSS files in … Read more
Array and other collection indexes represent memory offsets, so logically enough they begin at zero. XML and XPATH indexes represent positions and counts, so logically enough they begin at one (and zero is therefore representative of “empty”)
Use a recursive method: <xsl:template name=”output-tokens”> <xsl:param name=”list” /> <xsl:variable name=”newlist” select=”concat(normalize-space($list), ‘ ‘)” /> <xsl:variable name=”first” select=”substring-before($newlist, ‘ ‘)” /> <xsl:variable name=”remaining” select=”substring-after($newlist, ‘ ‘)” /> <id> <xsl:value-of select=”$first” /> </id> <xsl:if test=”$remaining”> <xsl:call-template name=”output-tokens”> <xsl:with-param name=”list” select=”$remaining” /> </xsl:call-template> </xsl:if> </xsl:template>
Try this expression… string-join(//element3/(concat(element4/text(), ‘.’, element5/text())), “ ”)
Update: @c0mrade has updated his question. Here is a solution to it: This XSLT transformation: <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”text”/> <xsl:strip-space elements=”*”/> <xsl:variable name=”vApos”>'</xsl:variable> <xsl:template match=”*[@* or not(*)] “> <xsl:if test=”not(*)”> <xsl:apply-templates select=”ancestor-or-self::*” mode=”path”/> <xsl:value-of select=”concat(‘=’,$vApos,.,$vApos)”/> <xsl:text>
</xsl:text> </xsl:if> <xsl:apply-templates select=”@*|*”/> </xsl:template> <xsl:template match=”*” mode=”path”> <xsl:value-of select=”concat(“https://stackoverflow.com/”,name())”/> <xsl:variable name=”vnumPrecSiblings” select= “count(preceding-sibling::*[name()=name(current())])”/> <xsl:if test=”$vnumPrecSiblings”> <xsl:value-of select=”concat(‘[‘, $vnumPrecSiblings … Read more