Re: Is it possible to dynamically select portions of an XML page?

Subject: Re: Is it possible to dynamically select portions of an XML page?
From: Steve Weyer <sweyer@xxxxxxxxxxxxxxxx>
Date: Fri, 14 May 1999 20:07:41 -0400
>Date: Fri, 14 May 1999 11:47:54 +0100
>From: Ben Robb <Ben@xxxxxxxxxx>
>Subject: Is it possible to dynamically select portions of an XML page?
>

if you're using IE5, one possible technique is shown in several of the
Msoft examples that do filtering/sorting, e.g., stock-sorter. basically,
you can modify the parameter in the style sheet directly since it's just an
attribute in an XML object.  for example, this snippet (from portfolio.xsl)
sets up a reference to sortField, and then changes it later.  I'd assume
that you could do something similar for your xsl:if condition by searching
for its test attribute.

  <SCRIPT><xsl:comment><![CDATA[
    function sort(field)
    {
      sortField.value=field;

sorted.XMLDocument.loadXML(portfolio.transformNode(sortStocks.XMLDocument));
    }
  ]]></xsl:comment></SCRIPT>

  <SCRIPT for="window" event="onload"><xsl:comment><![CDATA[
    sortField = sortStocks.selectSingleNode("//@order-by");
    sort("price");
  ]]></xsl:comment></SCRIPT>


>I have a large XML page, and I want to show only a small part of it via my
>XSL sheet.
>
...>
>		<xsl:if test=".TITLE='book1'">
>		<!-- show the book details-->
>
>		</xsl:if>
>
>and it works fine. Now for the slightly tricky bit. I want the "if"
>statement to be dynamic. I can pass the ASP page I am displaying the XML in
>a querystring. So is there a nice way to pass the querystring to the
>stylesheet and have it act on it?
>
>something like (but not, since you can;t use % symbols)
>
><xsl:if test=".TITLE='<%=Request.QueryString("title")%>'">



Steve
weyer@xxxxxxxx
http://members.bellatlantic.net/~sweyer/index.htm



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread