How to display same type of data from XML using XSLT

Posted by MKS on Stack Overflow See other posts from Stack Overflow or by MKS
Published on 2010-11-22T04:33:00Z Indexed on 2011/03/15 16:10 UTC
Read the original article Hit count: 217

Filed under:
|

Hi Guys,

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>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xslt