locked
Performing XSLT Transform Client Side with ASP.NET RRS feed

  • Question

  • User-947014007 posted

    I'd like to be able to write a c# function that is able to take parameters and then based on these, transform a given xml file against a given xslt file.

    But I'd to be able to call this function client side via a JQuery ajax request.

    I was thinking that I could just have the function sitting behind an aspx page, and I could pull the parameters from the querystring. Something like:


    dotransform.aspx?xmlfile=abc.xml&xslfile=123.xsl&param1=one&param2=two


    Does anyone know if there is a better way of performing this task?  I'm kinda new to this so any help is aprreciated.


    Wednesday, August 12, 2009 6:15 AM

Answers

  • User1835330922 posted

    ASP.NET runs on the server so your subject "Performing XSLT Transform Client Side with ASP.NET" is rather misleading. It is certainly possible to write an ASP.NET .aspx that takes parameters in the query string and runs an XSLT 1.0 transformation using System.Xml.Xsl.XslCompiledTransform and returns the transformation result to the client.

    Other possible ways to run a method on the server and have it callable by client-side script are PageMethods and scriptable web services.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 12, 2009 9:22 AM

All replies

  • User1835330922 posted

    ASP.NET runs on the server so your subject "Performing XSLT Transform Client Side with ASP.NET" is rather misleading. It is certainly possible to write an ASP.NET .aspx that takes parameters in the query string and runs an XSLT 1.0 transformation using System.Xml.Xsl.XslCompiledTransform and returns the transformation result to the client.

    Other possible ways to run a method on the server and have it callable by client-side script are PageMethods and scriptable web services.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 12, 2009 9:22 AM
  • User-947014007 posted

    Cheers - will check out scriptable web services. Thanks for pointing me in the right direction!

    Wednesday, August 12, 2009 10:10 AM