Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Passing parameters to XSLT

Passing parameters to XSLT

Scheduled Pinned Locked Moved XML / XSL
xmljavascripthtmlsalesregex
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gktony
    wrote on last edited by
    #1

    Sorry I have to repeat the question I have a XSLT and I want to pass a parameter runtime with javascript. Here is my XSL <xsl:param name="surname" select="surname"/> <xsl:template match="customer"> <tr> <td><xsl:value-of select="$surname"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="DOB"/></td> </tr> </xsl:template> I need to populate the surname, I am using the DOM object in javascript Thanks in advance Tony

    P 1 Reply Last reply
    0
    • G Gktony

      Sorry I have to repeat the question I have a XSLT and I want to pass a parameter runtime with javascript. Here is my XSL <xsl:param name="surname" select="surname"/> <xsl:template match="customer"> <tr> <td><xsl:value-of select="$surname"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="DOB"/></td> </tr> </xsl:template> I need to populate the surname, I am using the DOM object in javascript Thanks in advance Tony

      P Offline
      P Offline
      Prateek G
      wrote on last edited by
      #2

      var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); var xslProc; xslDoc.async = false; xslDoc.resolveExternals = false; xslDoc.load("YourXsl.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load(YourXmlString); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; xslProc.addParameter("surname",valueofSurname) xslProc.output will give u desired table.. u just need to put it as innerHTML for ur page/form...

      G 1 Reply Last reply
      0
      • P Prateek G

        var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); var xslProc; xslDoc.async = false; xslDoc.resolveExternals = false; xslDoc.load("YourXsl.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load(YourXmlString); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; xslProc.addParameter("surname",valueofSurname) xslProc.output will give u desired table.. u just need to put it as innerHTML for ur page/form...

        G Offline
        G Offline
        Gktony
        wrote on last edited by
        #3

        Thanks for that, However it returns me a single value of the valueofSurname. For example if the surname is "Stevens" will populate every surname with "Stevens" in the column. What I need to do is to be able to change the value-of column and select firstname instead of surname. regards Tony

        P 1 Reply Last reply
        0
        • G Gktony

          Thanks for that, However it returns me a single value of the valueofSurname. For example if the surname is "Stevens" will populate every surname with "Stevens" in the column. What I need to do is to be able to change the value-of column and select firstname instead of surname. regards Tony

          P Offline
          P Offline
          Prateek G
          wrote on last edited by
          #4

          Then u can incorporate the same in ur xslt itself, u just need to use xpath,select desired node and directly put the value. If u can give me same xml and xsl may be i can give u an example of the same.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups