reading variables from a URL in an XSL page.

M

McGowan

Hi,

Trying to display only a certain type of data depending on a variable
passed through a url. For example if I had a list of CDs and I wanted
to display only the ones by greenday I would pass the variable
greenday via the url (http://www.somewhere.com/CDs.xml?
artist=greenday)

so I could then use: <xsl:for-each select="catalog/
cd[artist='greenday']">

I'm not sure how to retrieve the artist from the URL? I have accepted
the possibility that I may not be able to retrieve the data in this
way at all. If that is the case what is another method I could use?

Thanks,
Oliver
 
M

Martin Honnen

McGowan said:
Trying to display only a certain type of data depending on a variable
passed through a url. For example if I had a list of CDs and I wanted
to display only the ones by greenday I would pass the variable
greenday via the url (http://www.somewhere.com/CDs.xml?
artist=greenday)

so I could then use: <xsl:for-each select="catalog/
cd[artist='greenday']">

If you have server-side scripting (e.g. ASP or JSP or PHP or similar)
then you can solve it like this
http://example.com/transform.asp?xml=CDs.xml&artist=greenday
where your server-side script reads out the query string to find the XML
document and possible parameters, then loads the stylesheet and an XSLT
processor to pass in the parameters (stylesheet needs e.g.
<xsl:param name="artist"/>
), runs the transformation and sends the transformation result (e.g.
HTML document) back to the client.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,800
Messages
2,569,657
Members
45,416
Latest member
MyraTrotte
Top