转换xml+;xsd到xhtml
我正在尝试将带有xsd模式的xml转换为xhtml 因此,在我的xml文件中,我有如下内容:转换xml+;xsd到xhtml,xml,xhtml,xsd,Xml,Xhtml,Xsd,我正在尝试将带有xsd模式的xml转换为xhtml 因此,在我的xml文件中,我有如下内容: <shf:BookShelf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="BookShelf BookShelf.xsd" xmlns:shf="BookShelf" xmlns:bk="BookType" xmlns:cmn="C
<shf:BookShelf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="BookShelf BookShelf.xsd"
xmlns:shf="BookShelf"
xmlns:bk="BookType"
xmlns:cmn="CommonType">
<shf:Book Category="Physics">
<bk:Name></bk:Name>
<bk:Author>
<cmn:FirstName></cmn:FirstName>
<cmn:FamilyName></cmn:FamilyName>
</bk:Author>
<bk:Pages></bk:Pages>
<bk:Language></bk:Language>
<cmn:Source></cmn:Source>
</shf:Book>
...
</shf:BookShelf>
...
我知道将xml转换为xhtml要容易得多,但现在我有了
,如何在xsl中引用这个条目?这是我在xsl中所做的,但它不起作用:
<xsl:for-each select="BookShelf/Book">
<tr>
<td><xsl:value-of select="Name"/></td>
</tr>
</xsl:for-each>
您可以使用:
<xsl:for-each select="shf:BookShelf/shf:Book">
<tr>
<td><xsl:value-of select="bk:Name"/></td>
</tr>
</xsl:for-each>
并在
中声明名称空间:
。。。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:shf="BookShelf" xmlns:bk="BookType" xmlns:cmn="CommonType"> ...