开发者

Why is this XSL template NOT valid?

here is the XML I'm treating:

<dsQueryResponse>
<Rows>
<Row ID="14"></Row>
</Rows>
</dsQueryResponse>

This XSL is working:

    <xsl:template match="Row">
        <xsl:value-of select="@ID"/>
    </xsl:template>

But not this one:

<xsl:template match="/">
   开发者_如何学Go <xsl:call-template name="CustomTemplate"/>
</xsl:template>

<xsl:template name="CustomTemplate">
    <xsl:template match="Row">
        <xsl:value-of select="@ID"/>
    </xsl:template>
</xsl:template>

I need to fit with the second structure, making a call-template, does anyone understand what has to be changed in the second XSL ?


I don't think you can nest templates like that. What you can do is the following:

<xsl:template match="/">
  <xsl:call-template name="CustomTemplate"/>
</xsl:template>

<xsl:template name="CustomTemplate" match="Row">
  <!-- format rows here -->
</xsl:template>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜