Quantcast

Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Philippe.Favrais
Hello All,

So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically computed.
However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.

I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)
Does some of you have ideas to investigate ?

Here is a example of my XSL where i use <saxon:call-template>
        <xsl:template match="*:ECUC-MODULE-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>                
               
<saxon:call-template name="{$sn}"/>
       
</xsl:template>
               
       
<xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>
       
       
<xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>


       
<xsl:template match="*:PARAMETERS/*">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>

       
<xsl:template match="*:REFERENCES/*">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeeGeneral">
     
<FeeGeneral>
       
<ShortName>FeeGeneral</ShortName>
       
<xsl:apply-templates/>
     
</FeeGeneral>
 
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeePublishedInformation">
     
<FeePublishedInformation>
       
<ShortName>FeePublishedInformation</ShortName>
       
<xsl:apply-templates/>
     
</FeePublishedInformation>
 
</xsl:template>
.......


Thank you for your help
Philippe
------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Wolfgang May


On Wed, 17 Aug 2016, [hidden email] wrote:

> Hello All,
>
> So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically
> computed.
> However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.
>
> I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)
> Does some of you have ideas to investigate ?

I did such dynamic things in the following style, encoding it in an XML variable:

   <xsl:variable name="foo"><xsl:element name="$templatename"/></>
   <xsl:apply-templates select="$foo"> ... parameters handling ... </>

And the templates instead of
   <xsl:template name="templatename_i">...</>
are of the form
   <xsl:template match="templatename_i">...</>

Wolfgang

>
> Here is a example of my XSL where i use <saxon:call-template>
>         <xsl:template match="*:ECUC-MODULE-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>                
>                <saxon:call-template name="{$sn}"/>
>        </xsl:template>
>                
>        <xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>        
>        <xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>
>        <xsl:template match="*:PARAMETERS/*">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>        <xsl:template match="*:REFERENCES/*">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>   <!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
>   <!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
>   <xsl:template name="FeeGeneral">
>      <FeeGeneral>
>         <ShortName>FeeGeneral</ShortName>
>         <xsl:apply-templates/>
>      </FeeGeneral>
>   </xsl:template>
>
>   <!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
>   <!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
>   <xsl:template name="FeePublishedInformation">
>      <FeePublishedInformation>
>         <ShortName>FeePublishedInformation</ShortName>
>         <xsl:apply-templates/>
>      </FeePublishedInformation>
>   </xsl:template>
> .......
>
> Thank you for your help
> Philippe
>
------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Michael Kay
In reply to this post by Philippe.Favrais
There are several dynamic despatch mechanisms in XSLT 3.0:

(1) template rules. These become more flexible with the ability to match on atomic values as well as nodes. For example you could replace

<xsl:template name="a"/>

<xsl:variable name="A" select="'a'"/>
<saxon:call-template name="$A"/>

with

<xsl:template match=".[.='a']">

<xsl:variable name="A" select="'a'"/>
<xsl:apply-templates select="$A"/>

(2) Higher-order functions

Including the ability to lookup functions dynamically by name. So you could do

<function name="f:a" xmlns:f="http:/f/"/>

<xsl:variable name="A" select="'a'"/>
<xsl:sequence select="function-lookup(QName("http:/f/", $a))()"/>


Michael Kay
Saxonica


On 17 Aug 2016, at 11:10, [hidden email] wrote:

Hello All,

So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically computed.
However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.

I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)
Does some of you have ideas to investigate ?

Here is a example of my XSL where i use <saxon:call-template>
        <xsl:template match="*:ECUC-MODULE-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>                
               
<saxon:call-template name="{$sn}"/>
       
</xsl:template>
               
       
<xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>
       
       
<xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>


       
<xsl:template match="*:PARAMETERS/*">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>

       
<xsl:template match="*:REFERENCES/*">
               
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
               
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
               
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
               
<saxon:call-template name="{$template_name}"/>
       
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeeGeneral">
     
<FeeGeneral>
       
<ShortName>FeeGeneral</ShortName>
       
<xsl:apply-templates/>
     
</FeeGeneral>
 
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeePublishedInformation">
     
<FeePublishedInformation>
       
<ShortName>FeePublishedInformation</ShortName>
       
<xsl:apply-templates/>
     
</FeePublishedInformation>
 
</xsl:template>
.......


Thank you for your help
Philippe------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Philippe.Favrais
Hello Michael,
Thank you for the reply,
But both solutions requieres quite a lot of change in my xsl as i have a lot of named template.
Philippe




De :        Michael Kay <[hidden email]>
A :        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Cc :        [hidden email]
Date :        17/08/2016 13:19
Objet :        Re: [saxon] Need an alternative solution to saxon:call-template        that is not anymore supported in Saxon 9.7




There are several dynamic despatch mechanisms in XSLT 3.0:

(1) template rules. These become more flexible with the ability to match on atomic values as well as nodes. For example you could replace

<xsl:template name="a"/>

<xsl:variable name="A" select="'a'"/>
<saxon:call-template name="$A"/>

with

<xsl:template match=".[.='a']">

<xsl:variable name="A" select="'a'"/>
<xsl:apply-templates select="$A"/>

(2) Higher-order functions

Including the ability to lookup functions dynamically by name. So you could do

<function name="f:a" xmlns:f="http:/f/"/>

<xsl:variable name="A" select="'a'"/>
<xsl:sequence select="function-lookup(QName("http:/f/", $a))()"/>


Michael Kay
Saxonica


On 17 Aug 2016, at 11:10, [hidden email] wrote:

Hello All,

So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically computed.

However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.


I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)

Does some of you have ideas to investigate ?


Here is a example of my XSL where i use <saxon:call-template>

       
<xsl:template match="*:ECUC-MODULE-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>                
             
<saxon:call-template name="{$sn}"/>
     
</xsl:template>
             
     
<xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>
     
     
<xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>


     
<xsl:template match="*:PARAMETERS/*">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>

     
<xsl:template match="*:REFERENCES/*">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeeGeneral">
   
<FeeGeneral>
       
<ShortName>FeeGeneral</ShortName>
       
<xsl:apply-templates/>
   
</FeeGeneral>
 
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeePublishedInformation">
   
<FeePublishedInformation>
       
<ShortName>FeePublishedInformation</ShortName>
       
<xsl:apply-templates/>
   
</FeePublishedInformation>
 
</xsl:template>
.......


Thank you for your help

Philippe
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Philippe.Favrais
In reply to this post by Wolfgang May
Wolfgang,
Thank you for the reply,
Philippe



De :        Wolfgang May <[hidden email]>
A :        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Cc :        [hidden email]
Date :        17/08/2016 12:53
Objet :        Re: [saxon] Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7






On Wed, 17 Aug 2016, [hidden email] wrote:

> Hello All,
>
> So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically
> computed.
> However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.
>
> I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)
> Does some of you have ideas to investigate ?

I did such dynamic things in the following style, encoding it in an XML variable:

  <xsl:variable name="foo"><xsl:element name="$templatename"/></>
  <xsl:apply-templates select="$foo"> ... parameters handling ... </>

And the templates instead of
  <xsl:template name="templatename_i">...</>
are of the form
  <xsl:template match="templatename_i">...</>

Wolfgang

>
> Here is a example of my XSL where i use <saxon:call-template>
>         <xsl:template match="*:ECUC-MODULE-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>                
>                <saxon:call-template name="{$sn}"/>
>        </xsl:template>
>                
>        <xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>        
>        <xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>
>        <xsl:template match="*:PARAMETERS/*">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>        <xsl:template match="*:REFERENCES/*">
>                <xsl:variable name="sn" select="./*:SHORT-NAME"/>
>                <xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
>                <xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then
> $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
>                <saxon:call-template name="{$template_name}"/>
>        </xsl:template>
>
>   <!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
>   <!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
>   <xsl:template name="FeeGeneral">
>      <FeeGeneral>
>         <ShortName>FeeGeneral</ShortName>
>         <xsl:apply-templates/>
>      </FeeGeneral>
>   </xsl:template>
>
>   <!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
>   <!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
>   <xsl:template name="FeePublishedInformation">
>      <FeePublishedInformation>
>         <ShortName>FeePublishedInformation</ShortName>
>         <xsl:apply-templates/>
>      </FeePublishedInformation>
>   </xsl:template>
> .......
>
> Thank you for your help
> Philippe
> ------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need an alternative solution to saxon:call-template that is not anymore supported in Saxon 9.7

Michael Kay
In reply to this post by Philippe.Favrais
Sorry about that.

To retain saxon:call-template we would have had to do considerable re-design to make it work with XSLT 3.0 packages, and the facility is no longer needed for new applications because the requirement is met by higher-order functions. But we should probably think more carefully these days about the transition costs for users. Unfortunately we often have very little idea whether a feature in the product is still being used - I suspect there are many that are not.

Michael Kay
Saxonica

On 22 Aug 2016, at 07:59, [hidden email] wrote:

Hello Michael,
Thank you for the reply,
But both solutions requieres quite a lot of change in my xsl as i have a lot of named template.
Philippe




De :        Michael Kay <[hidden email]>
A :        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Cc :        [hidden email]
Date :        17/08/2016 13:19
Objet :        Re: [saxon] Need an alternative solution to saxon:call-template        that is not anymore supported in Saxon 9.7




There are several dynamic despatch mechanisms in XSLT 3.0:

(1) template rules. These become more flexible with the ability to match on atomic values as well as nodes. For example you could replace

<xsl:template name="a"/>

<xsl:variable name="A" select="'a'"/>
<saxon:call-template name="$A"/>

with

<xsl:template match=".[.='a']">

<xsl:variable name="A" select="'a'"/>
<xsl:apply-templates select="$A"/>

(2) Higher-order functions

Including the ability to lookup functions dynamically by name. So you could do

<function name="f:a" xmlns:f="http:/f/"/>

<xsl:variable name="A" select="'a'"/>
<xsl:sequence select="function-lookup(QName("http:/f/", $a))()"/>


Michael Kay
Saxonica


On 17 Aug 2016, at 11:10, [hidden email] wrote:

Hello All,

So far i was using Saxon-B to run my XSL where i used <saxon:call-template name="$template_name"> because the template names are dynamically computed.

However recently, i bought Saxon EE 9.7 and realized that <saxon:call-template/> is not anymore supported.


I am trying the find an alternative solution with a minimum of impact on my existing XSL (as i would have many to modify)

Does some of you have ideas to investigate ?


Here is a example of my XSL where i use <saxon:call-template>

       
<xsl:template match="*:ECUC-MODULE-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>                
             
<saxon:call-template name="{$sn}"/>
     
</xsl:template>
             
     
<xsl:template match="*:ECUC-PARAM-CONF-CONTAINER-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>
     
     
<xsl:template match="*:ECUC-CHOICE-CONTAINER-DEF">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>


     
<xsl:template match="*:PARAMETERS/*">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>

     
<xsl:template match="*:REFERENCES/*">
             
<xsl:variable name="sn" select="./*:SHORT-NAME"/>
             
<xsl:variable name="fqname">/<xsl:value-of select="ancestor-or-self::*/*:SHORT-NAME" separator="/" /></xsl:variable>
             
<xsl:variable name="template_name" select="if ($map_template_name/*:entry[@fqname=$fqname]) then $map_template_name/*:entry[@fqname=$fqname]/@template_name else $sn"/>
             
<saxon:call-template name="{$template_name}"/>
     
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeeGeneral-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeeGeneral">
   
<FeeGeneral>
       
<ShortName>FeeGeneral</ShortName>
       
<xsl:apply-templates/>
   
</FeeGeneral>
 
</xsl:template>

 
<!--QNAME : /AUTOSAR/EcucDefs/Fee/FeePublishedInformation-->
 
<!--TYPE : ECUC-PARAM-CONF-CONTAINER-DEF-->
 
<xsl:template name="FeePublishedInformation">
   
<FeePublishedInformation>
       
<ShortName>FeePublishedInformation</ShortName>
       
<xsl:apply-templates/>
   
</FeePublishedInformation>
 
</xsl:template>
.......


Thank you for your help

Philippe
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...