RE: [xsl] xsl:choose and multiple (sibling) elements

Subject: RE: [xsl] xsl:choose and multiple (sibling) elements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 13 Apr 2006 15:33:52 +0100
> the xsl:when seems to work, since in my resulting file (XSL-FO 
> respectively PDF after converting with apache FOP) the 
> relevant line is 
> blank and not filled by the xsl:otherwise. unfortunately the 
> xsl:value-of 
> doesn't work, i hoped that the ../inhalt would lead the processor to <
> inhalt>BBEZ ist vorhanden</inhalt>, since <textListe> is also 
> a child of <
> element> as <belegBereich> is. didn't work.

xsl:when does not change the context node (that is, it doesn't "lead the
processor" anywhere). All it does is establish whether
<belegBereich>BBEZ</belegBereich> exists.

You want this:

<xsl:variable name="belegBereich" select="//belegBereich[. = 'BBEZ']"/>
  <xsl:when test="$belegBereich">
    <xsl:value-of select="$belegBereich/../textListe/inhalt"/>

Michael Kay

> how do i need to write the xpath-adressing in the 
> xsl:value-of select in 
> order to get my desired value?
> i tried many different approaches, including to wrap a 
> xsl:for-each (with 
> an absolute path until <element>) around the xsl:choose, 
> which ended up in 
> printing the desired text 8 times next to each other (= number of 
> <element> tags)... but at least 
> thx a lot in advance
> alex
> ______________________________________________________________________
> Der Austausch von Nachrichten mit Software Daten Service via 
> E-Mail dient ausschliesslich Informationszwecken. 
> Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium 
> nicht ausgetauscht werden.
> Correspondence with Software Daten Service via e-mail is only 
> for information purposes. This medium is not to be used for 
> the exchange of legally-binding communications. 

Current Thread