-1
여기에 정말 이상한 문제가 있습니다. 다음 xml 파일의 노드 값을 가져올 수 없습니다. 아무도 내 xslt 파일이나 xml 파일에 문제가 있다고 말할 수 있습니까? 내가 다른 xml 파일에서 xslt 작업을 할 수 있기 때문에 정말 간단합니다. 그래서 나는 여기에서 길을 잃었다. XML 파일은 XSLT에서 노드 값을 가져올 수 없습니다.
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" xmlns:xlink="http://www.w3.org/1999/xlink" name="Test Data">
<service name="tss" serviceType="OpenDAP" base="http://virbo.org/metamag/viewDataFile.jsp?filetype=data&docname="/>
<dataset name="Scalar">
<access serviceName="tss" urlPath="597C7956-742D-FEC6-D151-A37A7176E867"/>
<documentation type="summary">Single variable time series</documentation>
</dataset>
<dataset name="Structure">
<access serviceName="tss" urlPath="E981F1AF-EF4A-11FB-AFB6-F20218B07783"/>
<documentation type="summary">Vector (three component) time series</documentation>
</dataset>
<dataset name="Sequence">
<access serviceName="tss" urlPath="64C78182-9BDC-CBC4-56C5-679808F51398"/>
<documentation type="summary">Spectrum time series</documentation>
</dataset>
</catalog>
XSLT 파일
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<h2>database</h2>
<li>
<xsl:for-each select="/catalog/dataset/access/@serviceName">
<xsl:value-of select="."/>
</xsl:for-each>
</li>
</xsl:template>
</xsl:stylesheet>
하지만 XSLT 파일은/데이터/학생/이름/@ ID로 XPath를 변경하여 다음과 같은 XML 파일에서 작동
<data class="grade2">
<student id="test1">
<name id="1">Bitu Kumar</name>
<course>MCA</course>
<sem>6</sem>
<marks>80</marks>
</student>
<student id="test2">
<name id="2">Santosh Kumar</name>
<course>MCA</course>
<sem>5</sem>
<marks>70</marks>
</student>
<student id="test3">
<name id="3">Ashish</name>
<course>M.Sc.</course>
<sem>4</sem>
<marks>80</marks>
</student>
<student id="test4">
<name id="4">Mahesh</name>
<course>MA</course>
<sem>3</sem>
<marks>80</marks>
</student>
</data>
감사 답장을 많이, 당신은 XPath는에 네임 스페이스 접두사를 사용하는 방법을 예제를 줄 수 있습니까? – user851380
내가 추가해야하는 네임 스페이스는 무엇입니까? 이 하나? – user851380
xmlns = "http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" – user851380