|
I'm trying the following xsl file <?xml version="1.0"
encoding='ISO-8859-1'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
indent="yes" />
<xsl:import href="Homepage.xsl"
/>
<xsl:import href="greatNew.xsl"
/> <xsl:variable
name="selectedTemplateForBlocknew_1">greatNew</xsl:variable>
<xsl:template
match="page">
<html>
<body>
<xsl:apply-templates select="page_block" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
where Homepage.xsl content is:
<?xml version="1.0"
encoding='ISO-8859-1'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
indent="yes" />
<xsl:template
match="page_block[@type='noticia' and @index_num='1']" >
<xsl:call-template name='$selectedTemplateForBlocknew_1' />
<br/>
</xsl:template>
</xsl:stylesheet>
and greatNew.xsl has
<?xml version="1.0" encoding='ISO-8859-1'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template name="greatNew">
Great new<br/>
<xsl:value-of select="."
/>
<br/>End new
</xsl:template>
</xsl:stylesheet>
when I apply the first xsl to a valid xml I get an error
javax.xml.transform.TransformerException: Could not find template named:
$selectedTemplateForBlocknew_1
but if I replace <xsl:call-template
name='$selectedTemplateForBlocknew_1' /> by <xsl:value-off
select='$selectedTemplateForBlocknew_1' /> all works fine, the value of
de variable appears in de output .... this means that I can�t use a variable for
de name o a xsl:call-template directive?
Thanks for your help
Luis Villar Esmoris
Madrid-Spain
[EMAIL PROTECTED]
|
- Re: xsl:variable problem Luis Villar
- Re: xsl:variable problem David_Marston
- xsl:variable problem Luis Villar
