#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Passing parameter via urlquery / pure xml/xslt


    Hi experts,

    I am quite new to xml/xslt programming...

    I am using pure xml/xslt (no java, no php...) and want to pass a parameter value from xml to the xslt file.
    I tried to do this via a urlquery in the xml file
    Code:
     <a>           
     <xsl:attribute name="href">
    ./myfile.xml?myparam=value  </xsl:attribute>
    click here
    </a>
    and tried to get the value within the xslt file with

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:param name=myparam/> 
    
    <xsl:template match="/">
        <html>
          <body>
              <p>
              <xsl:value-of select="$myparam" />
              </p>
          </body>
         </html>
      </xsl:template>
    </xsl:stylesheet>
    However, I could not obtain the value - myparam appears empty.

    Can such an approach work at all if no "wrapping" language is used?


    Cheers
    Silver fern

    P.S.: And sorry, if that is a very stupid question...
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,759
    Rep Power
    9397
    Originally Posted by silver_fern
    I tried to do this via a urlquery in the xml file
    Code:
     <a>           
     <xsl:attribute name="href">
    ./myfile.xml?myparam=value  </xsl:attribute>
    click here
    </a>
    That doesn't make sense. You have some <a> in the XML, using an XSLT attribute, to link to itself with a query string?

IMN logo majestic logo threadwatch logo seochat tools logo