Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Yes, it's possible, and relatively easy to do so.</strong> </p> <p>Below is an example XSLT that produces an HTML document with a table row for each <code>&lt;multRef&gt;</code> element.</p> <p>Each child element of <code>&lt;multiRef&gt;</code> is first rendered as a table header using the name of the element for the heading column, and then each <code>&lt;multiRef&gt;</code> is rendered as rows with columns for each of the child elements:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="/"&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;table border="1"&gt; &lt;xsl:apply-templates select="*/*/multiRef[1]" mode="header"/&gt; &lt;xsl:apply-templates select="*/*/multiRef" /&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; &lt;xsl:template match="multiRef" mode="header"&gt; &lt;thead&gt; &lt;tr&gt; &lt;xsl:apply-templates mode="header"/&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/xsl:template&gt; &lt;xsl:template match="multiRef/*" mode="header"&gt; &lt;th&gt; &lt;xsl:value-of select="local-name()"/&gt; &lt;/th&gt; &lt;/xsl:template&gt; &lt;xsl:template match="multiRef"&gt; &lt;tr&gt; &lt;xsl:apply-templates/&gt; &lt;/tr&gt; &lt;/xsl:template&gt; &lt;xsl:template match="multiRef/*"&gt; &lt;td&gt; &lt;xsl:apply-templates/&gt; &lt;/td&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>When applied to the sample XML provided, it produces the following HTML:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;META http-equiv="Content-Type" content="text/html; charset=UTF-16"&gt; &lt;/head&gt; &lt;body&gt; &lt;table border="1"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;description&lt;/th&gt; &lt;th&gt;id&lt;/th&gt; &lt;th&gt;issueSecurityScheme&lt;/th&gt; &lt;th&gt;key&lt;/th&gt; &lt;th&gt;lead&lt;/th&gt; &lt;th&gt;name&lt;/th&gt; &lt;th&gt;notificationScheme&lt;/th&gt; &lt;th&gt;permissionScheme&lt;/th&gt; &lt;th&gt;projectUrl&lt;/th&gt; &lt;th&gt;url&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tr&gt; &lt;td&gt;Mobile Web Project POC &lt;/td&gt; &lt;td&gt;10034&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;XLIPOC&lt;/td&gt; &lt;td&gt;benm&lt;/td&gt; &lt;td&gt;Redacted Project&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;https://redacted.com/browse/REDACTED&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;10017&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;GIC&lt;/td&gt; &lt;td&gt;gregm&lt;/td&gt; &lt;td&gt;REDACTED&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;https://redacted.com/browse/REDACTED&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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