相关疑难解决方法(0)

XSL xsl:template match ="/"

我只是在学习XML以及如何使用XSL文件.在XSL文件中,我发现了以下术语:

xsl:template match="/"
Run Code Online (Sandbox Code Playgroud)

这代表什么?我可以用什么而不是/?我可以写table或任何其他HTML标签而不是/

xml xslt xslt-2.0 xslt-1.0

53
推荐指数
3
解决办法
9万
查看次数

关于XSLT的初学者问题"apply-templates"

对于这样一个非常简单的XML:

<catalog>
    <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
    </cd>
    <cd>
        <title>Hide your heart</title>
        <artist>Bonnie Tyler</artist>
        <country>UK</country>
        <company>CBS Records</company>
        <price>9.90</price>
        <year>1988</year>
    </cd>
    <cd>
        <title>Greatest Hits</title>
        <artist>Dolly Parton</artist>
        <country>USA</country>
        <company>RCA</company>
        <price>9.90</price>
        <year>1982</year>
    </cd>
</catalog>
Run Code Online (Sandbox Code Playgroud)

和一个简单的xslt:

<xsl:template match="/">
 <xsl:apply-templates/>  
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

为什么会产生如下输出:

Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985

Hide your heart
Bonnie Tyler
UK
CBS Records
9.90
1988

Greatest Hits
Dolly Parton
USA
RCA
9.90
1982
Run Code Online (Sandbox Code Playgroud)

所有XML标签都去了哪里?我应该<xsl:apply-templates/><xsl:copy>标签包围以 使其工作吗?

xml xslt

1
推荐指数
1
解决办法
460
查看次数

标签 统计

xml ×2

xslt ×2

xslt-1.0 ×1

xslt-2.0 ×1