Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default XML Filter

    I am trying to use XML and XSL together with ASP. I have
    the following ASP:

    set xml = Server.CreateObject("Microsoft.XMLDOM")
    xml.async = false
    xml.load(Server.MapPath("articleIndex.xml"))

    set xsl = Server.CreateObject("Microsoft.XMLDOM")
    xsl.async = false
    xsl.load(Server.MapPath("xslTest.xsl"))

    Response.Write(xml.transformNode(xml))

    And the following XSL:

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html>
    <body>
    <xsl:for-each select="articles/article">
    <xsl:sort select="@newsDateSort" order="descending" />

    <p>
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="@prPath" />
    </xsl:attribute>

    <xsl:value-of select="@newsDate" /> - <xsl:value-
    of select="headline" />
    </a>
    </p>
    </xsl:for-each>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

    I want to filter the XML - such as - "articles/article
    [@component='someValue']" before calling or within the XSL
    file. I have tried using many different methods but
    nothing seems to work. I now that this must be easy.

    What is the best way to do this?

    Thank you
    rpjoseph Guest

  2. Similar Questions and Discussions

    1. about filter
      hello, In PDF file,<</Length 120/Filter/FlateDecode/I 144/L 128/S 40/V 106>> ,what does "I,L,V" mean? what the different between "<</Length...
    2. #40499 [NEW]: filter sapi does not register any highlightning filter
      From: php at henke37 dot cjb dot net Operating system: any PHP version: 6CVS-2007-02-15 (CVS) PHP Bug Type: Apache2 related...
    3. Data Grid Header Filter Renderer or how do I get aheader to filter the data in a datagrid.
      Okay so on the same theme as why isn't the datagrid like Excel, I have created a (very cool) Filter header. 1) The filter looks like any other...
    4. CSS Filter
      I can't seem to get my alpha filter to render in firefox, but it does fine in IE. Anyone know what's up with this, i've been working with CSS for a...
    5. Filter
      hello sir, i have a form which has a subform1 and the subform1 has subform2 i am able to filter main form for a particular number of feilds...
  3. #2

    Default XML Filter

    I forgot an important part of this. I need the filter to
    be dynamic based on Request.QueryString. So I either need
    to filter the XML before transformation or pass a variable
    to XSL to be used as <xsl:param..>
    >-----Original Message-----
    >I am trying to use XML and XSL together with ASP. I have
    >the following ASP:
    >
    > set xml = Server.CreateObject("Microsoft.XMLDOM")
    > xml.async = false
    > xml.load(Server.MapPath("articleIndex.xml"))
    >
    > set xsl = Server.CreateObject("Microsoft.XMLDOM")
    > xsl.async = false
    > xsl.load(Server.MapPath("xslTest.xsl"))
    >
    > Response.Write(xml.transformNode(xml))
    >
    >And the following XSL:
    >
    ><?xml version="1.0"?>
    ><xsl:stylesheet version="1.0"
    >xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    ><xsl:template match="/">
    ><html>
    ><body>
    ><xsl:for-each select="articles/article">
    ><xsl:sort select="@newsDateSort" order="descending" />
    >
    > <p>
    > <a>
    > <xsl:attribute name="href">
    > <xsl:value-of select="@prPath" />
    > </xsl:attribute>
    >
    > <xsl:value-of select="@newsDate" /> - <xsl:value-
    >of select="headline" />
    > </a>
    > </p>
    > </xsl:for-each>
    > </body>
    > </html>
    ></xsl:template>
    ></xsl:stylesheet>
    >
    >I want to filter the XML - such as - "articles/article
    >[@component='someValue']" before calling or within the
    XSL
    >file. I have tried using many different methods but
    >nothing seems to work. I now that this must be easy.
    >
    >What is the best way to do this?
    >
    >Thank you
    >.
    >
    Guest

  4. #3

    Default Re: XML Filter

    <anonymous@discussions.microsoft.com> wrote in message
    news:01d601c3a49c$2a42cc20$a401280a@phx.gbl...
    > I forgot an important part of this. I need the filter to
    > be dynamic based on Request.QueryString. So I either need
    > to filter the XML before transformation or pass a variable
    > to XSL to be used as <xsl:param..>
    >
    > >-----Original Message-----
    > >I am trying to use XML and XSL together with ASP. I have
    > >the following ASP:
    > >
    > > set xml = Server.CreateObject("Microsoft.XMLDOM")
    > > xml.async = false
    > > xml.load(Server.MapPath("articleIndex.xml"))
    > >
    > > set xsl = Server.CreateObject("Microsoft.XMLDOM")
    > > xsl.async = false
    > > xsl.load(Server.MapPath("xslTest.xsl"))
    > >
    > > Response.Write(xml.transformNode(xml))
    > >
    > >And the following XSL:
    > >
    > ><?xml version="1.0"?>
    > ><xsl:stylesheet version="1.0"
    > >xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    > ><xsl:template match="/">
    > ><html>
    > ><body>
    > ><xsl:for-each select="articles/article">
    > ><xsl:sort select="@newsDateSort" order="descending" />
    > >
    > > <p>
    > > <a>
    > > <xsl:attribute name="href">
    > > <xsl:value-of select="@prPath" />
    > > </xsl:attribute>
    > >
    > > <xsl:value-of select="@newsDate" /> - <xsl:value-
    > >of select="headline" />
    >
    > > </a>
    > > </p>
    > > </xsl:for-each>
    > > </body>
    > > </html>
    > ></xsl:template>
    > ></xsl:stylesheet>
    > >
    > >I want to filter the XML - such as - "articles/article
    > >[@component='someValue']" before calling or within the
    > XSL
    > >file. I have tried using many different methods but
    > >nothing seems to work. I now that this must be easy.
    > >
    > >What is the best way to do this?
    > >
    > >Thank you
    If you were pulling the data from a db, I would recommend you filter the
    data there. But since the xml is a flat file, you will need to pass a
    parameter into the stylesheet (xsl). Here's the documentation for
    addParameter method of the DOMDocument object. The example is pretty
    self explanatory. In the future, please indicate which version of
    IIS/ASP you are running. Also,when dealing with XML/DOM please indicate
    which version of MSXML you are using.

    [url]http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xml_mth_ac_5pgy.asp[/url]

    HTH
    -Chris


    Chris Hohmann Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139