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

  • SEARCH
  • Home
  • 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 3405992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:34:25+00:00 2026-05-18T05:34:25+00:00

I am using XSLT and XML. I have got below XML. <documentCountryInformation> <countryCode>US</countryCode> <countryName>United

  • 0

I am using XSLT and XML.

I have got below XML.

<documentCountryInformation>
        <countryCode>US</countryCode>
        <countryName>United States</countryName>
        <sufficientDocumentation>Conditional</sufficientDocumentation>
        <sectionInformation>
          <sectionName>Health</sectionName>
          <documentParagraph paragraphId="23628">
            <paragraphType>Requirement</paragraphType>
            <paragraphText>
              <p>
                Vaccination for
                <strong>yellow fever</strong>
                Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days.
              </p>
            </paragraphText>
          </documentParagraph>            
        </sectionInformation>
</documentCountryInformation>
<documentCountryInformation>
        <countryCode>IN</countryCode>
        <countryName>India</countryName>
        <sufficientDocumentation>Conditional</sufficientDocumentation>
        <sectionInformation>
          <sectionName>Health</sectionName>
          <documentParagraph paragraphId="23648">
            <paragraphType>Requirement</paragraphType>
            <paragraphText>
              <p>
                Vaccination for
                <strong>Dengue fever</strong>
                Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days.
              </p>
            </paragraphText>
          </documentParagraph>            
        </sectionInformation>
</documentCountryInformation>

Above is the part of full xml and you can see there are two records of same type, now I have got the <countryName> in parameters of XSLT in above example my countryName parameter will contain this type of data “United States,India”, Now I want to split the parameter data and further it will check the XML having same country name and display the data according, I mean there will be loop on country name and below is desired HTML.

<div class="resultsContainer" id="divTransit">
        <h3>Transit - United States (US)</h3>                            
        <p>
        Vaccination for
        <strong>yellow fever</strong>
        Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days.
        </p>

        <h3>Transit - India (IN)</h3>                            
        <p>
        Vaccination for
        <strong>Dengue fever</strong>
        Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days.
        </p>
</div>
  • 1 1 Answer
  • 1 View
  • 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-18T05:34:25+00:00Added an answer on May 18, 2026 at 5:34 am

    Now I want to split the parameter data
    and further it will check the XML
    having same country name and display
    the data according, I mean there will
    be loop on country name and below is
    desired HTML.

    There is no need to “split” the parameter value, nor for a “loop” of any kind.

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:param name="pCountryName" select="'United States,India'"/>
    
     <xsl:template match="/*">
       <div class="resultsContainer" id="divTransit">
         <xsl:apply-templates select=
          "*[contains(concat(',',$pCountryName,','),
                      concat(',',countryName,',')
                      )
            ]
          "/>
       </div>
     </xsl:template>
    
     <xsl:template match="documentCountryInformation">
      <h3>
        <xsl:value-of select=
         "concat('Transit - ',
                 countryName,
                 ' (',
                 countryCode,
                 ')'
                 )
         "/>
      </h3>
      <xsl:copy-of select="*/*/paragraphText/node()"/>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document (wrapped in a top element to become wellformed):

    <t>
        <documentCountryInformation>
            <countryCode>US</countryCode>
            <countryName>United States</countryName>
            <sufficientDocumentation>Conditional</sufficientDocumentation>
            <sectionInformation>
                <sectionName>Health</sectionName>
                <documentParagraph paragraphId="23628">
                    <paragraphType>Requirement</paragraphType>
                    <paragraphText>
                        <p>
                    Vaccination for
                            <strong>yellow fever</strong>
                    Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days.
                        </p>
                    </paragraphText>
                </documentParagraph>
            </sectionInformation>
        </documentCountryInformation>
        <documentCountryInformation>
            <countryCode>IN</countryCode>
            <countryName>India</countryName>
            <sufficientDocumentation>Conditional</sufficientDocumentation>
            <sectionInformation>
                <sectionName>Health</sectionName>
                <documentParagraph paragraphId="23648">
                    <paragraphType>Requirement</paragraphType>
                    <paragraphText>
                        <p>
                    Vaccination for
                            <strong>Dengue fever</strong>
                    Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days.
                        </p>
                    </paragraphText>
                </documentParagraph>
            </sectionInformation>
        </documentCountryInformation>
    </t>
    

    produces the wanted, correct result:

    <div class="resultsContainer" id="divTransit">
       <h3>Transit - United States (US)</h3>
    
       <p>
                    Vaccination for
                            <strong>yellow fever</strong>
                    Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days.
                        </p>
    
       <h3>Transit - India (IN)</h3>
    
       <p>
                    Vaccination for
                            <strong>Dengue fever</strong>
                    Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days.
                        </p>
    
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to merge elements using XSLT. If I have the following XML
I have an XSLT transform I am using to process an XML file, inserting
All, I have an XML file which I transform it using an XSLT document
I want to apply an XSLT Stylesheet to an XML Document using C# and
I am trying to sort an xml using xsl. Got some sample from xml.com.
I am using xslt to transform an xml document to html for use in
I am trying to insert xml elements into an xml file using XSLT. I
I just started on a xml document just for practicing xslt and I have
Question Using XSLT 1.0, given a string with arbitrary characters how can I get
I'd like to output html controls using xslt, but I need to be able

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.