使用第三方api进行xml到html的转换

时间:2014-04-12 05:06:30

标签: xml xslt-1.0

我正在使用第三方API并以xml格式获取数据。我怎么能把这个数据转换成html文件。 我是网络服务的新手 我试着写xslt文件,但我不太确定标签

  <Result>
        <Error>False</Error>
        <Total>8</Total>
        <Query>diabetes</Query>
        <Language>English</Language>
        <Topics Count="4">
            <Topic>
                <Id>14</Id>
                <Title>Get Your Cholesterol Checked</Title>
                <Categories>Screening Tests, Doctor Visits, Doctor Visits</Categories>
                <Populations />
                <MyHFTitle />
                <MyHFDescription />
                <MyHFCategory />
                <LastUpdate>2/18/2014 9:33:17 AM</LastUpdate>
                <ImageUrl>http://www.healthfinder.gov/HealthTopics/glmedia/icons/getyourcholesterolchecked.jpg</ImageUrl>
                <ImageAlt>smiling couple</ImageAlt>
                <AccessibleVersion>http://healthfinder.gov/HealthTopics/Category/doctor-visits/screening-tests/get-your-cholesterol-checked</AccessibleVersion>
                <RelatedItems>
                    <Item>
                        <Title>Heart Healthy Foods: Shopping list</Title>
                        <Url>http://healthfinder.gov/HealthTopics/Category/health-conditions-and-diseases/heart-health/heart-healthy-foods-shopping-list</Url>
                        <Type>tool</Type>
                    </Item>
                    <Item>
                        <Title>Heart Health: Conversation starters</Title>
                        <Url>http://healthfinder.gov/HealthTopics/Category/health-conditions-and-diseases/heart-health/heart-health-conversation-starters</Url>
                        <Type>tool</Type>
                    </Item>
                    <Item>
                        <Title>Reduce Your Risk of Stroke</Title>
                        <Url>http://healthfinder.gov/HealthTopics/Category/health-conditions-and-diseases/heart-health/reduce-your-risk-of-stroke</Url>
                        <Type>topic</Type>
                    </Item>
                    <Item>
                        <Title>Keep Your Heart Healthy</Title>
                        <Url>http://healthfinder.gov/HealthTopics/Category/health-conditions-and-diseases/heart-health/keep-your-heart-healthy</Url>
                        <Type>topic</Type>
                    </Item>
                </RelatedItems>
    this is the xmls file

1 个答案:

答案 0 :(得分:0)

您将不得不构建XSL。这是一个方便的网站,可以帮助您:

http://www.w3schools.com/Xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_apply

和一个很好的参考:

http://www.w3schools.com/Xsl/default.asp

希望这有帮助。