cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Barth" <christ...@buerobarth.de>
Subject AW: Why doesn't this XSL work??
Date Tue, 10 Jan 2006 14:27:57 GMT
> -----Urspr√ľngliche Nachricht-----
> Von: Sylvain Wallez [mailto:sylvain@apache.org] 
> Gesendet: Dienstag, 10. Januar 2006 15:08
> An: users@cocoon.apache.org
> Betreff: Re: Why doesn't this XSL work??
> 
> Christian Barth wrote:
> > Hi!
> >
> >
> > I wrote the following XSL-File:
> >  
> > ...
> > <xsl:for-each
> > 
> select="//Bs_Bauteil_Liste/Brandwand_Liste/Brandwand[funktion='Trennwa
> > nd']"> <xsl:variable name="ID" select="@ID" /> <xsl:variable 
> > name="bez" select="bezeichnung" /> <xsl:variable name="wand_ID" 
> > select="Wand_id_Liste/wand_id"/> <xsl:for-each 
> > 
> select="//Gebaeude[@ID=$gebId]/Stockwerk_Liste/Stockwerk[@ID=$stock_ID
> > ]//bau
> > teil_id">
> > <xsl:if test=". = $wand_ID">
> > nTrennwand=nNodeIdx;
> > nNodeIdx++;
> > Note(nTrennwand,nTrennwaende,'<xsl:value-of
> > select="$bez"/>','javascript:select(\'wand\', 
> > 	\'Trennwand\',<xsl:value-of select="$ID"/>,<xsl:value-of
> > select="$stock_ID"/>)','wand')
> > <xsl:sort select="." order="ascending" data-type="text"/> 
> > <xsl:for-each 
> > select="//Bauteil[@ID=$wand_id]/Wand/Oeffnungs_Liste/Oeffnung">
> > ...
> >
> > It's just a part of the file. But the rest is working. My 
> Problem is 
> > the <xsl:if>. Is there anything wrong with it? It's always true.
> > When I write <xsl:value-of select="." /> and <xsl:value-of 
> select="$wand_ID"
> > />, the values are correct. I don't understand this.
> >   
> 
> This because this tests compares the string values of 
> elements. So if they happen to have the same content or be 
> both empty, the test will be true. If you want to test these 
> are the same nodes, you can use
>   <xsl:if test="generate-id(.) = generate-id($wand_ID)">
> 

I want to compare the string values. So the test should be correct, right?


> > Another problem is that when I remove the <xsl:sort>-Tag I get an 
> > "Unable to get transformer handler"-error.
> > I thought the sort-Tag is optional, isn't it?
> >   
> 
> Yep. Now I can't see a closing <xsl:if tag>. Is it somewhere 
> down the XSL?
> 

Here is the complete for-each-code:

<xsl:for-each
select="//Bs_Bauteil_Liste/Brandwand_Liste/Brandwand[funktion='Trennwand']">
	<xsl:variable name="ID" select="@ID" />
	<xsl:variable name="bez" select="bezeichnung" />
	<xsl:variable name="wand_ID" select="Wand_id_Liste/wand_id"/>
	<xsl:for-each
select="//Gebaeude[@ID=$gebId]/Stockwerk_Liste/Stockwerk[@ID=$stock_ID]//bau
teil_id">
		<xsl:if test="generate-id(.) = generate-id($wand_ID)">
			nTrennwand=nNodeIdx;
			nNodeIdx++;
			Note(nTrennwand,nTrennwaende,'<xsl:value-of
select="$bez"/>','javascript:select(\'wand\', 
				\'Trennwand\',<xsl:value-of
select="$ID"/>,<xsl:value-of select="$stock_ID"/>)','wand')
			<xsl:sort select="." order="ascending"
data-type="text"/>
			<xsl:for-each
select="//Bauteil[@ID=$wand_id]/Wand/Oeffnungs_Liste/Oeffnung">
				<xsl:if test="Tuer">
					nNodeIdx++;
					nOeffnung=nNodeIdx;
					Note(nOeffnung,nTrennwand,'Tuer
','javascript:select(\'oeffnung\', 
						\'Tuer\',<xsl:value-of
select="@ID"/>)','tuer')
					nNodeIdx++;
				</xsl:if>
				<xsl:if test="Fenster">
					nNodeIdx++;
					nOeffnung=nNodeIdx;
					Note(nOeffnung,nTrennwand,'Fenster
','javascript:select(\'oeffnung\', 
						\'Fenster\',<xsl:value-of
select="@ID"/>)','fenster')
					nNodeIdx++;
				</xsl:if>
			</xsl:for-each>
		</xsl:if>	
	</xsl:for-each>
</xsl:for-each>


I hope this helps. This is the working code. When I remove the sort-tag I
get the error I mensioned before


Barthi


> Sylvain
> 
> -- 
> Sylvain Wallez                        Anyware Technologies
> http://bluxte.net                     http://www.anyware-tech.com
> Apache Software Foundation Member     Research & Technology Director
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message