Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to merge element using xslt?
    text
    copied!<p>I have an reference type of paragraph with element.</p> <p>Example</p> <p>Input file:</p> <pre><code>&lt;reference&gt; &lt;emph type="bold"&gt;Antony&lt;/emph&gt;&lt;emph type="bold"&gt;,&lt;/emph&gt; &lt;emph type="bold"&gt;R.&lt;/emph&gt; &lt;emph type="bold"&gt;and&lt;/emph&gt; &lt;emph type="bold"&gt;Micheal&lt;/emph&gt;&lt;emph type="bold"&gt;,&lt;/emph&gt; &lt;emph type="bold"&gt;V.&lt;/emph&gt; &lt;emph type="italic"&gt;reference title&lt;/emph&gt;&lt;/reference&gt; </code></pre> <p>Output received now:</p> <pre><code>&lt;p class="reference"&gt;&lt;strong&gt;Antony&lt;/strong&gt;&lt;strong&gt;,&lt;/strong&gt; &lt;strong&gt;R.&lt;/strong&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;strong&gt;Micheal&lt;/strong&gt;&lt;strong&gt;,&lt;/emph&gt; &lt;emph type="bold"&gt;V.&lt;/strong&gt; &lt;em&gt;reference title&gt;&lt;/em&gt;&lt;/p&gt; </code></pre> <p>Required output file:</p> <pre><code>&lt;p class="reference"&gt;&lt;strong&gt;Antony, R. and Micheal, V.&lt;/strong&gt; &lt;em&gt;reference title&lt;/em&gt;&lt;/p&gt; </code></pre> <p>My xslt scripts:</p> <pre><code>&lt;xsl:template match="reference"&gt; &lt;p class="reference"&gt;&lt;xsl:apply-templates/&gt;&lt;/p&gt; &lt;/xsl:template&gt; &lt;xsl:template match="emph"&gt; &lt;xsl:if test="@type='bold'"&gt; &lt;strong&gt;&lt;xsl:apply-templates/&gt;&lt;/strong&gt; &lt;/xsl:if&gt; &lt;xsl:if test="@type='italic'"&gt; &lt;em&gt;&lt;xsl:apply-templates/&gt;&lt;/em&gt; &lt;/xsl:if&gt; &lt;/xsl:template&gt; </code></pre> <p>What needs to be corrected in xslt to get the <code>&lt;strong&gt;</code> element single time like the required output file?</p> <p>Please advice anyone..</p> <p>By, Antny.</p>
 

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