Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6907327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:25:15+00:00 2026-05-27T08:25:15+00:00

It seems as if I can’t use an Xpath in the name attribute of

  • 0

It seems as if I can’t use an Xpath in the name attribute of the call-template element. How can I get around this? Any help/thoughts would be awesome!

<xsl:for-each select="child::knomaddb/Content/Videos">
        <xsl:result-document method="xhtml" href="{local-name()}.html">
            <html>
                <body>
                    <h1>Knomad</h1>
                    <h2>{local-name()} Videos</h2>
                    <table border="1">
                        <tr bgcolor="#9acd32">
                            <th>Title</th>
                            <th>Video</th>
                            <th>Description</th>
                            <th>Comments</th>
                        </tr>
                        <xsl:for-each select="Video">
                            <xsl:call-template name="{ancestor::local-name()}"/>
                        </xsl:for-each>
                    </table>
                </body>
            </html>
        </xsl:result-document>
    </xsl:for-each>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:25:16+00:00Added an answer on May 27, 2026 at 8:25 am

    It seems as if I cant use an Xpath in the name attribute of the
    call-template element. How can I get around this?

    Good question, +1.

    You can’t. But you can use instead <xsl:apply-templates>.

    Here is a quick demo:

    <xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:double="double" xmlns:incr="incr" xmlns:my="my:my"
    exclude-result-prefixes="double incr my"
    >
      <xsl:output method="text"/>
    
       <double:double/>
       <incr:incr/>
    
       <xsl:variable name="vFuncDouble"
            select="document('')/*/double:*[1]"/>
    
       <xsl:variable name="vFuncIncr"
            select="document('')/*/incr:*[1]"/>
    
       <xsl:function name="my:double">
         <xsl:param name="arg1" />
    
          <xsl:sequence select="2*$arg1"/>
       </xsl:function>
    
       <xsl:function name="my:incr">
         <xsl:param name="arg1" />
    
          <xsl:sequence select="1+$arg1"/>
       </xsl:function>
    
        <xsl:template name="double" match="double:*">
          <xsl:param name="arg1"/>
    
          <xsl:sequence select="my:double($arg1)"/>
        </xsl:template>
    
        <xsl:template name="incr" match="incr:*">
          <xsl:param name="arg1"/>
    
          <xsl:sequence select="my:incr($arg1)"/>
        </xsl:template>
    
        <xsl:function name="my:apply">
          <xsl:param name="pFun" as="element()"/>
          <xsl:param name="arg1"/>
    
          <xsl:apply-templates select="$pFun">
            <xsl:with-param name="arg1" select="$arg1"/>
          </xsl:apply-templates>
        </xsl:function>
    
        <xsl:template match="/">
         <xsl:sequence select="my:apply($vFuncIncr, my:apply($vFuncDouble,2))"/>
        </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on any XML document (not used), the wanted result is produced:

    5
    

    Do note:

    One can pass as parameter (the first argument) to my:apply() any “function” and my:apply() will apply it to its second argument.

    Using this same principle the FXSL library implemented Higher Order Functions (HOFs) in XSLT 1.0 and XSLT 2.0 — read more here.

    In the forthcoming XPath 3.0 functions are for the first time first class objects in the Xpath Data Model (XDM).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple example I can't seems to get working : MERGE INTO
It seems I can use self or this for referring to the mixed-in instance
It seems I can't easily have an XSD declaration for this simple XML <root>
It seems like I can't use shell_exec or proc_open on my shared server. The
According to this question it seems like you can do this for Methods. What
I have looked at their help page it seems like I can register a
I've read the other posts here about this topic, but I can't seems to
It seems I can't do myObject.BeginAnimation(dp , animation) . Is this a bug or
It seems I can finally no longer avoid the use of apache rewrite rules
How to use getStartupArgs() Since 0.9.1 it seems you can read the command line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.