Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay repeated tags in XSLT?
    text
    copied!<p>I am working with a CV project using XML for storing CVs, using XSLT and Java to transform it to HTML.</p> <p>Following is the format of XML file</p> <pre><code>&lt;CVs&gt; &lt;cv&gt; &lt;name&gt;...&lt;/name&gt; &lt;dob&gt;...&lt;/dob&gt; &lt;experience&gt; &lt;job&gt;.....&lt;/job&gt; &lt;job&gt;.....&lt;/job&gt; &lt;/experience&gt; &lt;/cv&gt; &lt;cv&gt; &lt;name&gt;...&lt;/name&gt; &lt;dob&gt;...&lt;/dob&gt; &lt;experience&gt; &lt;job&gt;.....&lt;/job&gt; &lt;job&gt;.....&lt;/job&gt; &lt;job&gt;.....&lt;/job&gt; &lt;job&gt;.....&lt;/job&gt; &lt;job&gt;.....&lt;/job&gt; &lt;/experience&gt; &lt;/cv&gt; &lt;/CVs&gt; </code></pre> <p>What is the right way to display the <code>&lt;job&gt;</code> repeatedly? I am getting only one <code>&lt;job&gt;</code> and that the first one...</p> <p>Have a nice day John</p> <hr> <p>Thanks a lot for your reply. :)</p> <p>I tried the first solution. It works. But what I what I want is to display all the with a HTML paragraph formatting. </p> <p>First display the No.1, then there should be a paragraph, then No.2 and so on. like-</p> <pre><code>&lt;p&gt;Job No1&lt;/p&gt; &lt;p&gt;Job No2&lt;/p&gt; </code></pre> <p>I used following - with a failure to get the required result..</p> <pre><code>&lt;xsl:for-each select="Job"&gt; &lt;p style="color:red"&gt; &lt;xsl:if test="position() &amp;gt; 1"&gt;,&lt;/xsl:if&gt; &lt;xsl:value-of select="."/&gt; &lt;/p&gt; &lt;/xsl:for-each&gt; </code></pre> <p>Using the above code I am getting output like -</p> <pre><code>&lt;p&gt;Job No1 job No2..&lt;/p&gt; </code></pre> <p>I am using XSLT 1.0, which I mention to forget in the first post. Sorry for that, but you judged it.. Hmmm vast experience with XSLT.. Great.. </p> <p>Can you help me again..?</p> <p>Have a nice day John</p> <hr> <p>LarsH - Right said, I should have done all this in the first post itself, but somehow can't manage it. Now I have practiced the posting techniques and hereafter will do it correctly. :)</p> <p>Also, I have accepted Martin's answer. It did the job, with little modification I got the answer for the 2nd post of mine. </p> <p>Thanks a lot to all of you... </p> <p>Have a nice day John</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