Subject: AW: [xsl] XSL/XPath expression From: "Mengel Andre (FV/SLM) *" <Andre.Mengel@xxxxxxxxxxxx> Date: Wed, 16 May 2001 15:59:58 +0200 |
Dear Magnus I am not quite sure (because I am not an XSLT-Expert) but maybe this is also a solution: <xsl:template match="ElementList"> <xsl:apply-templates select="Element"/> </xsl:template> <xsl:template match="Element"> <xsl:if test="@Type[string(.)='2'][position()=1]"> do something </xsl:if> </xsl:template> regards André > -----Ursprüngliche Nachricht----- > Von: Eriksson Magnus [mailto:Magnus.eriksson@xxxxxxxxxxxx] > Gesendet: Mittwoch, 16. Mai 2001 13:40 > An: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' > Betreff: [xsl] XSL/XPath expression > > > Hi all! > > I have the following XML data: > > <ElementList> > <Element Type="1">1</Element> > <Element Type="1">2</Element> > <Element Type="2">3</Element> > <Element Type="2">4</Element> > </ElementList> > > To match only the 1st Element element with Type="2" when in > the ElementList > context node I could write: > > <xsl:if test="Element[@Type='2'][position()=1]"> > do something > </xsl:if> > > This seems to be working. What I really want to do, however, > is to have this > test inside the Element context node, but I have no clue how > to express > this: > > <xsl:template match="ElementList"> > <xsl:apply-templates select="Element"/> > </xsl:template> > <xsl:template match="Element"> > <xsl:if test="???[@Type='2'][position()=1]"> > do something > </xsl:if> > </xsl:template> > > Thanks in advance for any help. > > /Magnus Eriksson > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL/XPath expression, Eriksson Magnus | Thread | RE: [xsl] XSL/XPath expression, Michael Kay |
Re: [xsl] XSL/XPath expression, David Carlisle | Date | Re: [xsl] ShowTree XSL, Wendell Piez |
Month |