1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Filtering xml in xslt through query string

Discussion in 'XML & RSS' started by mnli19, Aug 9, 2010.

  1. #1
    I am working on a web site where I click on a link and it will navigate to a detail page to show the detail information related to the link. I have created the detail page using a xslt template and all contents in the detail page are comming from a xml file.

    to filter out only the relevant data from xml, I thought of passing a variable through query string and declare it as a xslt parameter in the detail xslt page. But I have no idea whether there is a way to pass variables through query string to the xslt page.

    I am new to xslt so It is greatly appreciated if someone can tell how this can be done or whether there is another easy way to do this?
     
    mnli19, Aug 9, 2010 IP
  2. cubicaaron

    cubicaaron Guest

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Could you give us some sample XML data and an idea of what you'd like to query.

    <ul>
    <xsl:if test="year &gt; 1949">
    <li>
    <xsl:value-of select="title"/>
    <xsl:value-of select="year"/>
    </li>
    </xsl:if>
    </ul>

    Are you looking to do something similar to this, i.e. querying the 'year' data?...
     
    cubicaaron, Aug 17, 2010 IP
  3. mnli19

    mnli19 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply cubicaaron

    I just found out the way of doing it. actually my problem was getting a query string value to a xslt parameter. with some searching I figured out that its not possible only using xslt. Instead I had to use a server side language something like PHP to pass and assign the query string (url variable) value to xslt parameter. I was able to do this through dreamweaver.
     
    mnli19, Aug 17, 2010 IP
  4. cubicaaron

    cubicaaron Guest

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok, well good luck and post again if you have any issues with the PHP!
     
    cubicaaron, Aug 18, 2010 IP
  5. mengusa

    mengusa Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Peon,
    Could you please show me how you do query string (url variable) xslt parameter in dreamweaver?
    Thank you
     
    mengusa, Apr 17, 2011 IP