Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6672025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:27:35+00:00 2026-05-26T03:27:35+00:00

I am working with a CV project using XML for storing CVs, using XSLT

  • 0

I am working with a CV project using XML for storing CVs, using XSLT and Java to transform it to HTML.

Following is the format of XML file

<CVs>
<cv>
<name>...</name>
<dob>...</dob>
<experience>
<job>.....</job>
<job>.....</job>
</experience>
</cv>
<cv>
<name>...</name>
<dob>...</dob>
<experience>
<job>.....</job>
<job>.....</job>
<job>.....</job>
<job>.....</job>
<job>.....</job>
</experience>
</cv>
</CVs>

What is the right way to display the <job> repeatedly? I am getting only one <job> and that the first one…

Have a nice day
John


Thanks a lot for your reply. 🙂

I tried the first solution. It works. But what I what I want is to display all the with a HTML paragraph formatting.

First display the No.1, then there should be a paragraph, then No.2 and so on.
like-

<p>Job No1</p>
<p>Job No2</p>

I used following – with a failure to get the required result..

<xsl:for-each select="Job">
<p style="color:red">
<xsl:if test="position() &gt; 1">,</xsl:if>
<xsl:value-of select="."/>
</p>
</xsl:for-each> 

Using the above code I am getting output like –

<p>Job No1 job No2..</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..

Can you help me again..?

Have a nice day
John


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. 🙂

Also, I have accepted Martin’s answer. It did the job, with little modification I got the answer for the 2nd post of mine.

Thanks a lot to all of you…

Have a nice day
John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:27:35+00:00Added an answer on May 26, 2026 at 3:27 am

    I guess the problem is that with XSLT 1.0 (or with an XSLT 2.0 processor running an XSLT 1.0 stylesheet in backwards compatible mode) the code

    <xsl:value-of select="job"/>
    

    outputs the string value of the first job element. If you want to output the value of all job elements then with XSLT 1.0 you need to use either

    <xsl:for-each select="job">
      <xsl:if test="position() &gt; 1">, </xsl:if>
      <xsl:value-of select="."/>
    </xsl:for-each>
    

    or <xsl:apply-templates select="job"/> with a template for job elements e.g.

    <xsl:template match="job">
      <xsl:if test="position() &gt; 1">, </xsl:if>
      <xsl:value-of select="."/>
    <xsl:template>
    

    while with XSLT 2.0 all you need is <xsl:value-of select="job" separator=", "/>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a Java programmer and was working on a project using Hibernate and
I'm currently working on a project which uses XSL-Transformations to generate HTML from XML.
Am working on a project that requires uploading xml file to remote FTP site.
I am working on project using lxml. here is a sample xml <PatientsTree> <Patient
I'm working on a project using Windows 2008, .NET 3.5 and WCF for some
I am working on a project using rails 2.1.1. With the new release of
I am working on a project using Castle Active Record. I stumbled across the
I'm working on a project using C++, Boost, and Qt. I understand how to
I am working on a project using Groovy, and I would like to take
I'm working on a project using Scala running Selenium tests as part of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.