我正在使用XSLT和XML。如何使用XSLT显示来自XML的相同类型的数据
我有下面的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>
以上是完整的XML的一部分,你可以看到有2个记录同一类型的,现在我已经在上面的例子中XSLT的参数得到了<countryName>
我国家名称参数将包含这种类型的数据“美国,印度”,现在我想拆分参数数据,并进一步它将检查具有相同国家名称和显示数据的XML,我的意思是将有循环国名和以下是所需的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>
我不明白的问题。这个输出对于XSLT模板匹配看起来很直接,为什么你需要一个“循环”? – 2010-11-22 05:14:28
它是我的想法是的你是对的,我们可以使用模板匹配,我想我们可能需要,因为我也分裂了参数值。请建议 – 2010-11-22 05:26:11
好问题,+1。查看我的答案,获取完整而简短的解决方案。 :) – 2010-11-22 05:35:48