开发者

Why is this XSL template NOT valid?

开发者 https://www.devze.com 2023-03-31 06:59 出处:网络
here is the XML I\'m treating: <dsQueryResponse> <Rows> <Row ID=\"14\"></Row> </Rows>

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

精彩评论

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