Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 23rd, 2006, 04:37 PM
Authorized User
 
Join Date: Apr 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling other templates

Hi!
Is it possible to use the call-template instruction inside a template to refer a template with a prefix, for example:

<xsl:template match="pmml:Itemset">
        <xsl:element name="otronode">
            <xsl:attribute name="id">
                <xsl:value-of select="@id"/>
            </xsl:attribute>
            <xsl:call-template name="pmml:ItemRef">
                ...
            </xsl:call-template>
         </xsl:element>
</xsl:template>

<xsl:template match="pmml:ItemRef">
</xsl:template

I got an error that no template exists named pmml:ItemRef. Is there another way to do it?

Thanks in advanced!

 
Old April 23rd, 2006, 05:12 PM
Authorized User
 
Join Date: Apr 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, try using name with mode/match attributes, eg:

<xsl:template name="pmml:ItemRef">
...
</xsl:template>

or

<xsl:template name="pmml" mode="ItemRef">
...
</xsl:template>

Hope this helps.



 
Old April 23rd, 2006, 05:52 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If your stylesheet contains

<xsl:call-template name="pmml:ItemRef">

then there must be a template declared with

<xsl:template name="pmml:ItemRef">

Declaring it as

<xsl:template match="pmml:ItemRef">

won't work. However, it's possible for a template to have both a match attribute and a name attribute.


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 24th, 2006, 06:47 AM
Authorized User
 
Join Date: Apr 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks shasto100 for the recommendation.

 
Old April 24th, 2006, 06:48 AM
Authorized User
 
Join Date: Apr 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Michael Kay






Similar Threads
Thread Thread Starter Forum Replies Last Post
"templates" Somesh ASP.NET 2.0 Professional 8 March 27th, 2007 08:53 AM
Templates pilcher85 Dreamweaver (all versions) 1 March 21st, 2007 05:51 PM
Templates ervinel Classic ASP Basics 0 July 13th, 2006 02:47 PM
Templates Neal XSLT 1 February 10th, 2006 07:54 AM
Calling templates from other documents. spencer.clark XSLT 1 July 11th, 2005 10:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.