multiple filtering

S

sp

<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
 
S

Soren Kuula

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
 

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

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,851
Latest member
CliftonCor

Latest Threads

Top