|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] AW: XSL/XPath expression
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/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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








