passing parameters from xsl to cgi script

Discussion in 'Perl Misc' started by lievemario, Nov 23, 2004.

  1. lievemario

    lievemario Guest

    I have made a perl script witch gets information out of a database,
    transfers it into an xml-file file and than I parse this to a html document
    using xsl.
    The problem is dat the html doc needs a parameter which can be found in the
    xml file.
    I've done something like
    <xsl:variable name="id" select="person_id"/>
    <a href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
    select="name"></xsl:value-of><xsl:value-of
    select="first_name"></xsl:value-of></a>

    Of course this doesn't give me the value of the id-variable. But it just
    returns $id.
    How can I solve this?

    Thanks

    L
     
    lievemario, Nov 23, 2004
    #1
    1. Advertising

  2. lievemario <> wrote:

    > I've done something like

    ^^^^^^^^^^^^^^

    That is not good enough for us to be able to help you.

    Show us something "exactly like" what you've done, and we
    can help you fix it.


    > How can I solve this?



    You have not communicated to us what, exactly, the "this" is.

    Post a short and complete program *that we can run* that illustrates
    your problem, and we will help solve your problem.


    Have you seen the Posting Guidelines that are posted here frequently?


    use PSI::ESP; # cutsie talk for a wild-ass guess at what the problem is

    perldoc -q variable

    How can I expand variables in text strings?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Nov 23, 2004
    #2
    1. Advertising

  3. On Tue, 23 Nov 2004 12:11:32 +0100, lievemario wrote:

    > I have made a perl script witch gets information out of a database,
    > transfers it into an xml-file file and than I parse this to a html document
    > using xsl.
    > The problem is dat the html doc needs a parameter which can be found in the
    > xml file.
    > I've done something like
    > <xsl:variable name="id" select="person_id"/>
    > <a href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
    > select="name"></xsl:value-of><xsl:value-of
    > select="first_name"></xsl:value-of></a>
    >
    > Of course this doesn't give me the value of the id-variable. But it just
    > returns $id.
    > How can I solve this?


    Maybe you meant to post this to comp.text.xml? This is more an issue with
    the XSLT you wrote than it is Perl.

    HTH

    Jim
     
    James Willmore, Nov 23, 2004
    #3
  4. lievemario wrote:
    > I have made a perl script witch gets information out of a database,
    > transfers it into an xml-file file and than I parse this to a html
    > document using xsl.
    > The problem is dat the html doc needs a parameter which can be found
    > in the xml file.
    > I've done something like
    > <xsl:variable name="id" select="person_id"/>
    > <a
    > href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
    > select="name"></xsl:value-of><xsl:value-of
    > select="first_name"></xsl:value-of></a>
    >
    > Of course this doesn't give me the value of the id-variable. But it
    > just returns $id.
    > How can I solve this?


    Please show us _exactly_ how you would like the generated XSL to look like
    and we can tell you how to create it from your Perl program.
    Would be good to have the relevant excerpt of your program as a
    self-contained, executable test program such that we can find and pinpoint
    the actual problem.
    With the little factual information you gave us it's all just reading tea
    leafes and crystal balls.

    jue
     
    Jürgen Exner, Nov 23, 2004
    #4
  5. lievemario wrote on 23 ÐоÑбрь 2004 11:11:

    > I have made a perl script witch gets information out of a database,
    > transfers it into an xml-file file and than I parse this to a html

    document
    > using xsl.
    > The problem is dat the html doc needs a parameter which can be found in

    the
    > xml file.
    > I've done something like
    > <xsl:variable name="id" select="person_id"/>
    > <a

    href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
    > select="name"></xsl:value-of><xsl:value-of
    > select="first_name"></xsl:value-of></a>
    >
    > Of course this doesn't give me the value of the id-variable. But it just
    > returns $id.
    > How can I solve this?
    >
    > Thanks
    >
    > L


    I guess this should work (I did'nt test it):

    <xsl:variable name="id" select="person_id"/>
    <xsl:element name="a">
    <xsl:attribute name="href">http://localhost/CGI/detailsselection.cgi?ID=
    <xsl:value-of select="$id"/>
    </xsl:attribute>
    <xsl:value-of select="name"/><xsl:value-of
    select="first_name"/>
    </xsl:element>



    --
    Andrew
     
    Andrew Tkachenko, Nov 23, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lievemario
    Replies:
    2
    Views:
    735
    lievemario
    Nov 23, 2004
  2. Replies:
    1
    Views:
    3,613
    A. Bolmarcich
    May 27, 2005
  3. sophie_newbie

    Passing cgi parameters to script...

    sophie_newbie, Dec 29, 2005, in forum: Python
    Replies:
    3
    Views:
    437
    Kent Johnson
    Dec 30, 2005
  4. Francis Hwang
    Replies:
    2
    Views:
    126
    Francis Hwang
    Oct 7, 2004
  5. kath
    Replies:
    4
    Views:
    654
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page