M
Martin Honnen
Boris Pöhlmann wrote:
Consider using
<xsl:call-template name="templateName">
<xsl:with-param name="fileName" select="@name" />
and then here
<xsl:template name="templateName">
<xslaram name="fileName" />
<xslaram name="xyz" />
do some stuff
I have a problem while trying to refer from a file called by the
document function to the document where it was called from. I give an
example:
<filelist>
<file name="whatever">
<url>foo/bar/somefile.xml</url>
</file>
<!-- ... -->
</filelist>
Now I call this template:
<xsl:template match="filelist">
<xsl:for-each select="file">
<xsl:apply-templates select="document(url)//xyz"/>
Consider using
<xsl:call-template name="templateName">
<xsl:with-param name="fileName" select="@name" />
</xsl:for-each>
</xsl:template>
Now I want the "xyz" template to get the "name" value of "file". I
tried the following (with Saxon 7.9.1), but apparently I can't reach
out of the document that has been called with "document()".
<xsl:template match="xyz"
<!-- do some stuff -->
<xsl:value-of select="ancestor::file/@name"/>
</xsl:template>
and then here
<xsl:template name="templateName">
<xslaram name="fileName" />
<xslaram name="xyz" />
do some stuff