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

  • Home
  • SEARCH
  • 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 4560218
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:53:58+00:00 2026-05-21T17:53:58+00:00

I have xsl view engine and want to call standard view helpers (e.g. UrlHelper.Action)

  • 0

I have xsl view engine and want to call standard view helpers (e.g. UrlHelper.Action) from xsl. But I failed to pass variable nembers of params to the helper methods.

The helper class:

namespace Services
{
    public class ViewHelper
    {
        // ...

        public string DummyHelper(params string[] dummyArgs)
        {
            return String.Concat(dummyArgs);
        }
    }
}

Adding helper support to xsl transformation:

var xsl = new XslCompiledTransform();
xsl.Load('MyView.xsl');
varc xsltArgs = new XsltArgumentList();
// Create helper, pass controller context as a param
var helper = new Services.ViewHelper(context));
xslt.AddExtensionObject("urn:helper", helper);
xsl.Transform(xmlDocument, xsltArgs, output);

One of xsl scripts that uses helper:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:h ="urn:helper"
    exclude-result-prefixes="h msxsl"
>
    <xsl:template match="/">
        <xsl:value-of select="h:DummyHelper('lorem', 'ipsum', 'dolor', 'sit', 'amet')"/>
    </xsl:template>
</xsl:stylesheet>

The exception raises with message that says: cannot find mthod DummyHelper with 5 args.

  • 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-21T17:53:59+00:00Added an answer on May 21, 2026 at 5:53 pm

    Well the documentation at http://msdn.microsoft.com/en-us/library/tf741884.aspx clearly says “Any method that is defined with the params keyword, which allows an unspecified number of parameters to be passed, is not currently supported by the XslCompiledTransform class.” so what you want is not supported. Depending on your needs you could consider whether implementing the functionality is possible with pure XSLT 2.0 and one of the .NET XSLT 2.0 processors like Saxon 9 or XQSharp. XSLT 2.0 is a lot more powerful than XSLT 1.0 and allows you to write functions with xsl:function in pure XSLT. For your sample you could simply do

    <xsl:value-of select="'lorem', 'ipsum', 'dolor', 'sit', 'amet'" separator=""/>
    

    in XSLT 2.0 or also

    <xsl:value-of select="string-join(('lorem', 'ipsum', 'dolor', 'sit', 'amet'), '')"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xsl template that I want to call to put into an
I have a xsl file where i need to use parameters from an external
I have a xsl:variable ($features-list) specified in my XSL which contains a tree fragment
I have been using XSL-FO and FOP Engine to generate PDF documents for required
I have a bunch of xsl files. I want to control an indent of
I have report that I must convert to PDF using xsl-fo from xml data
I have a XSL file to transfer another XSL file. I want the namespace
I have problem with proper charset encoding part of HTML view. XSL file in
I have xsl file whose size is approx 12kb, i want to zip it.
I have a XSLT sample copied straight from http://www.w3schools.com/xsl/xsl_transformation.asp , which I can't seem

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.