[xsl] XPATH | union operator question

Subject: [xsl] XPATH | union operator question
From: christof.hoeke@xxxxxxx
Date: Fri, 19 Dec 2003 16:05:46 +0100
i have a problem to understand why the following is happening:

in the following xml: if the inner @color is there use it, otherwise use the outer @color

	<line color="outer1">
		<x color="inner1"/>

so i tested the following XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:template match="/test">
	<xsl:template match="line">
	<xsl:template match="x">
			<xsl:value-of select="@color | parent::line/@color"/><br/>
			<xsl:value-of select="parent::line/@color | @color "/><br/>
			<xsl:value-of select="(@color | parent::line/@color)[1]"/><br/>
			<xsl:value-of select="(parent::line/@color | @color)[1] "/><br/>

	outer1<br />
	outer1<br />
	outer1<br />
	outer1<br />

i expected at least one inner1 to show up... 
or i expected "inner1outer1" as a result.

what does the | operator in "@color | parent::line/@color" select? only the most specific?

thanks a lot

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread