Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>One possible transformation that produces the required result is the following</strong>:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt; &lt;!-- --&gt; &lt;xsl:template match="/*"&gt; &lt;TABLE&gt; &lt;xsl:apply-templates select="*"/&gt; &lt;/TABLE&gt; &lt;/xsl:template&gt; &lt;!-- --&gt; &lt;xsl:template match="FUNCTION"&gt; &lt;ROW&gt; &lt;COL&gt;&lt;xsl:value-of select="@name"/&gt;&lt;/COL&gt; &lt;COL&gt;&lt;xsl:apply-templates select="PARAMETER"/&gt;&lt;/COL&gt; &lt;COL&gt;&lt;xsl:apply-templates select="CODE"/&gt;&lt;/COL&gt; &lt;/ROW&gt; &lt;/xsl:template&gt; &lt;!-- --&gt; &lt;xsl:template match="PARAMETER"&gt; &lt;xsl:param name="pDelim" select="';'"/&gt; &lt;xsl:value-of select= "concat(@name, substring($pDelim, 1 div not(position() = last())) )"/&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>When this transformation is applied on the original XML document</strong>:</p> <pre><code>&lt;SEARCHRESULTS&gt; &lt;FUNCTION name="BarGraph"&gt; &lt;PARAMETER name="numList"&gt;&lt;/PARAMETER&gt; &lt;PARAMETER name="maxValue"&gt;&lt;/PARAMETER&gt; &lt;CODE&gt;Some code&lt;/CODE&gt; &lt;/FUNCTION&gt; &lt;/SEARCHRESULTS&gt; </code></pre> <p><strong>The wanted result is produced</strong>:</p> <pre><code>&lt;TABLE&gt; &lt;ROW&gt; &lt;COL&gt;BarGraph&lt;/COL&gt; &lt;COL&gt;numList;maxValue&lt;/COL&gt; &lt;COL&gt;Some code&lt;/COL&gt; &lt;/ROW&gt; &lt;/TABLE&gt; </code></pre> <p><strong>Do note</strong> that the <strong><code>&lt;xsl:template&gt;</code></strong> which matches <strong><code>PARAMETER</code></strong> has a parameter <strong><code>$pDelim</code></strong>, which may be used to specify what character (or string) to use as a delimiter for the list of parameter names. The default value of this delimiter is set to ";".</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload