Forum Moderators: phranque

Message Too Old, No Replies

xml question - matching templates to a select group

xml

         

thebrax

3:33 pm on Jul 1, 2003 (gmt 0)

10+ Year Member



hi

ive got some xml like this

<programme>
<name>blah</name>
<onair>y</onair>
<genre>whatever</genre>
<ram>rp</ram>
<website>/whatever/</website>
<rplink>test</rplink>
</programme>

<programme>
<name>another</name>
<onair>y</onair>
<genre>whatever</genre>
<ram>rp</ram>
<website>/whatever/</website>
<rplink>test</rplink>
</programme>

and some templates to go with this...

in my xsl -
some html
then apply templates to <programme> elements beginning with 'A'
some html
then apply templates to <programme> elements beginning with 'B'
some html
then apply templates to <programme> elements beginning with 'C'

my question is how do i get that effect of applying to only elements with the first letter matching what i want...something like....

<xsl:apply-templates select="programme(name,1,1='a')" />

but that doesnt work

Anyone?

thebrax

3:42 pm on Jul 1, 2003 (gmt 0)

10+ Year Member



ah, i worked it out

<xsl:apply-templates select="programme[substring(name,1,1)='a']" />
etc
<xsl:apply-templates select="programme[substring(name,1,1)='b']" />
etc
<xsl:apply-templates select="programme[substring(name,1,1)='c']" />