multiple filtering

Discussion in 'XML' started by sp, Jan 30, 2006.

  1. sp

    sp Guest

    <files>
    <file id="1" type="txt">
    <indicies index="A">
    <keyword>key1</keyword>
    </indices>
    <indicies index="B">
    <keyword>key2</keyword>
    </indices>
    <indicies index="A">
    <keyword>key3</keyword>
    </indices>
    </file>
    <file id="2"type="doc">

    <indicies index="A">
    <keyword>key1</keyword>
    </indices>
    <indicies index="C">
    <keyword>key3</keyword>
    </indices>

    <indicies index="B">
    <keyword>key4</keyword>
    </indices>
    </file>
    <file id="3"type="txt">
    <indicies index="E">
    <keyword>key5</keyword>
    </indices>
    <indicies index="F">
    <keyword>key2</keyword>
    </indices>
    <indicies index="A">
    <keyword>key6</keyword>
    </indices>
    <indicies index="H">
    <keyword>key7</keyword>
    </indices>
    </file>
    </files>


    i need the output of those files whose type="txt" and index="A"

    the XSL i used

    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <xsl:template match="/>
    <xsl:for-each select="/files/file[@type='txt']">
    <xsl:apply-templates select="/indices[@index='A']" />
    </xsl:for-each>
    </xsl:template>
    <xsl:template match="/indicies[@index='A']" />
    <xsl:copy-of select="." />
    </xsl:template>
    </xsl:stylesheet>

    and i am not getting the output i expected can anyone help me out in
    solving this issue

    praveen
     
    sp, Jan 30, 2006
    #1
    1. Advertising

  2. sp

    Soren Kuula Guest

    sp wrote:
    <xsl:apply-templates select="/indices[@index='A']" />
    ...

    <xsl:template match="/indicies[@index='A']" />

    Ged rid of 'em leading slashes. The selection expression with the slash
    selects nodes that are document elements (aka root element of the
    document) and are named indices (and have an attribute named index with
    the value 'A'). The match pattern also only matches such nodes.

    Soren
     
    Soren Kuula, Jan 31, 2006
    #2
    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. Andreas
    Replies:
    1
    Views:
    1,683
    Tuukka Toivonen
    Dec 2, 2003
  2. Jon Sequeira
    Replies:
    3
    Views:
    4,210
    gerry
    Jun 26, 2003
  3. KJ

    Filtering Datagrid Rows Multiple Times

    KJ, Jan 21, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    118
  4. viktor9990

    filtering from multiple dropdownlists

    viktor9990, Apr 19, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    184
    Elton W
    Apr 19, 2005
  5. filtering from multiple dropdownlists

    , Jan 18, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    669
    Alvin Bruney [MVP]
    Jan 20, 2007
Loading...

Share This Page