Altova Mailing List Archives


XSLT Template: Reusing with document()

From: dutone <dutone@-------.--->
To: NULL
Date: 4/24/2008 7:50:00 PM
Is it possible to use a template and then, in the same transformation,
reuse it for a call to document()?

I have a document that has a child. If necessary, I need to include
another document's (same structure) child. I'd like to reuse a
template but it doesn't seem to be working out for me.

<xsl:template match="/root">
    <id><xsl:value-of select="name"/></id>
     <children>
         <xsl:apply-templates select="child"/>
         <xsl:if test="string-length($additonal-id)>0">
             <xsl:apply-templates select="document($additional-id)/
root"/>
         </xsl:if>
     </children>
</xsl:template>

<xsl:template match="child">
    ....
</xsl:template>

The code above will cause an infinite loop. I've tried passing the /
root/child element as a param to the child template, but that causes a
type mismatch error.

Any ideas? I'd hope that I wouldn't have to recreate the xsl:value-of
the elements of the child structure with a document()/root/.

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.