|
Subject: Re: [xsl] processor never reaches one line in my template. Why? From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Sun, 6 Mar 2005 11:07:31 +1100 |
Another error is the following:
<xsl:element name="svg">
<xsl:attribute name="xmlns">
<xsl:value-of select="'http://www.w3.org/2000/svg'"/>
</xsl:attribute>
This is not the way to produce a namespace node.
What XSLT processor are you using? Seems not quite compliant... And I
have a guess which it is...
Cheers,
Dimitre Novatchev
On Sat, 05 Mar 2005 12:33:38 +0100, Katharina Kreis
<katharinakreis@xxxxxx> wrote:
> Hi everybody!
>
> To understand my problem, I have to give you my xml and my xsl files.
> The xml file and the comments in the xsl files are in german, but I
> think that doesn't matter, important is the xsl syntax! The xml is
> really big, so I put it at the end of this mail.
>
> In the Gebauede.xsl file I have a template named "Bauteil" (the last
> one). I create a variable named "partOfStockwerk" and after this I have
> a <xsl:if> tag. This tag is never reached. Why? I debugged the whole
> stylesheet and the debugger always exits the template after the
> declaration of this variable. I have no idea why. Hope anybody can help
> me.....
>
> Cheers
> Katharina
>
> FILES:
>
> Bauvorhaben.xsl
>
=============================================================================
==
>
>
=============================================================================
==
>
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:math="http://exslt.org/math"
> extension-element-prefixes="math">
> <xsl:output method="xml" indent="yes" version="1.0"/>
>
> <!-- Globale Variablen: -->
> <xsl:variable name="bauvorhabenId" select="1"/>
> <xsl:variable name="gebaeudeId" select="1074492688"/>
> <xsl:variable name="stockwerkId" select="1076002008"/>
> <xsl:variable name="faktor" select="3"/>
> <xsl:variable name="deltaX" select="0"/>
> <xsl:variable name="deltaY" select="66.187"/>
>
> <xsl:include href="Gebaeude.xsl"/>
>
> <xsl:template name="Root" match="/">
> <!--
> Dieses Template ist das Wurzeltemplate. Es wird zuerst aufgerufen und
> ruft |ber
> das Bauvorhaben Template alle anderen Templates nacheinander auf!
> -->
> <xsl:apply-templates select="Bauvorhaben"/>
>
> </xsl:template>
>
> <xsl:template name="Bauvorhaben" match="Bauvorhaben[@ID=$bauvorhabenId]">
> <!--
> Dieses Template leitet den kompletten Zeichenvorgang ein.
> Der Zeichenbereich wird anhand der Grundst|ckskoordinaten festgelegt.
> Dabei hat das Koordinatensystem seinen Ursprung in der linken oberen
> Ecke.
> -->
> <xsl:variable name="y"
> select="Grundstueck_Liste/Grundstueck/einfuegepunkt/k2"/>
> <xsl:variable name="x"
> select="Grundstueck_Liste/Grundstueck/einfuegepunkt/k1"/>
>
> <!-- Maximalen x-Wert bestimmen -->
> <xsl:variable name="xWerte">
> <xsl:for-each
> select="Grundstueck_Liste/Grundstueck/basisflaeche/eckpunkt">
> <xsl:sort select="k1" data-type="number" order="descending"/>
> <xsl:value-of select="k1"/><xsl:text>+</xsl:text>
> </xsl:for-each>
> </xsl:variable>
> <xsl:variable name="maxx" select="substring-before($xWerte,'+') + $x"/>
>
> <!-- Minimalen x-Wert bestimmen -->
> <xsl:variable name="xWerte">
> <xsl:for-each
> select="Grundstueck_Liste/Grundstueck/basisflaeche/eckpunkt">
> <xsl:sort select="k1" data-type="number" order="ascending"/>
> <xsl:value-of select="k1"/><xsl:text>+</xsl:text>
> </xsl:for-each>
> </xsl:variable>
> <xsl:variable name="minx" select="substring-before($xWerte,'+') + $x"/>
>
> <!-- Maximalen y-Wert bestimmen -->
> <xsl:variable name="yWerte">
> <xsl:for-each
> select="Grundstueck_Liste/Grundstueck/basisflaeche/eckpunkt">
> <xsl:sort select="k2" data-type="number" order="descending"/>
> <xsl:value-of select="k2"/><xsl:text>+</xsl:text>
> </xsl:for-each>
> </xsl:variable>
> <xsl:variable name="maxy" select="substring-before($yWerte,'+') + $y"/>
>
> <!-- Minimalen x-Wert bestimmen -->
> <xsl:variable name="yWerte">
> <xsl:for-each
> select="Grundstueck_Liste/Grundstueck/basisflaeche/eckpunkt">
> <xsl:sort select="k2" data-type="number" order="ascending"/>
> <xsl:value-of select="k2"/><xsl:text>+</xsl:text>
> </xsl:for-each>
> </xsl:variable>
> <xsl:variable name="miny" select="substring-before($yWerte,'+') + $y"/>
>
> <!-- Der SVG Zeichenbereich wird erstellt: -->
> <xsl:element name="svg">
> <xsl:attribute name="xmlns"><xsl:value-of
> select="'http://www.w3.org/2000/svg'"/></xsl:attribute>
> <xsl:attribute name="width"><xsl:value-of
> select="($maxx+$deltaX)*$faktor*1.1"/></xsl:attribute>
> <xsl:attribute name="height"><xsl:value-of
> select="($maxy+$deltaY)*$faktor*1.1"/></xsl:attribute>
> <!-- Aufruf aller anderen Templates -->
> <xsl:apply-templates select="Grundstueck_Liste/Grundstueck"/>
> <xsl:apply-templates
>
select="Gebaeude[@ID=$gebaeudeId]/Stockwerk_Liste/Stockwerk[@ID=$stockwerkId]
/Nutzungszonen_Liste/Nutzungszone/Raum_Liste/Raum"/>
>
> <xsl:apply-templates
> select="Gebaeude[@ID=$gebaeudeId]/Bauteil_Liste/Bauteil"/>
> </xsl:element>
> </xsl:template>
>
> <xsl:template name="Grundstueck"
> match="Grundstueck[Gebaeude_ID_Liste/Gebaeude_ID=$gebaeudeId]">
>
> <!-- Festlegen der Eckpunkte des Grundst|cks -->
> <xsl:variable name="x" select="einfuegepunkt/k1"/>
> <xsl:variable name="y" select="einfuegepunkt/k2"/>
> <xsl:variable name="eckpunkte">
> <xsl:for-each select="basisflaeche/eckpunkt">
> <xsl:variable name="xl" select="k1"/>
> <xsl:variable name="yl" select="k2"/>
> <xsl:variable name="xges" select="$xl + $x"/>
> <xsl:variable name="yges" select="$yl + $y"/>
> <xsl:value-of
> select="($xges+$deltaX)*$faktor"/><xsl:text>,</xsl:text><xsl:value-of
> select="($yges+$deltaY)*$faktor"/><xsl:text> </xsl:text>
> </xsl:for-each>
> </xsl:variable>
>
> <!-- Darstellen des Grundst|cks als Polygon -->
> <xsl:element name="polygon">
> <xsl:attribute name="points"><xsl:value-of
> select="$eckpunkte"/></xsl:attribute>
> <xsl:attribute name="style"><xsl:value-of
> select="'fill:none;stroke:black'"/></xsl:attribute>
> </xsl:element>
>
> </xsl:template>
> </xsl:stylesheet>
>
> Gebaeude.xsl
>
=============================================================================
========
>
>
=============================================================================
========
>
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:math="http://exslt.org/math"
> extension-element-prefixes="math">
>
> <xsl:template name="Raum"
>
match="Raum[parent::Raum_Liste/parent::Nutzungszone/parent::Nutzungszonen_Lis
te/parent::Stockwerk/@ID=$stockwerkId]">
>
> <!-- Dieses Template zeichnet die Rdume des Stockwerks -->
> <xsl:if test="@ID='1076000816'">
> <!-- Eckpunkte des Raums werden festgelegt -->
> <xsl:variable name="x" select="einfuegepunkt/k1"/>
> <xsl:variable name="y" select="einfuegepunkt/k2"/>
> <xsl:variable name="eckpunkte">
> <xsl:for-each select="basisflaeche/eckpunkt">
> <xsl:variable name="xl" select="k1"/>
> <xsl:variable name="yl" select="k2"/>
> <xsl:variable name="xges" select="$xl + $x"/>
> <xsl:variable name="yges" select="$yl + $y"/>
> <xsl:value-of
> select="($xges+$deltaX)*$faktor"/><xsl:text>,</xsl:text><xsl:value-of
> select="($yges+$deltaY)*$faktor"/><xsl:text> </xsl:text>
> </xsl:for-each>
> </xsl:variable>
>
> <!-- Der Raum wird als Polygon dargestellt -->
> <xsl:element name="polygon">
> <xsl:attribute name="points"><xsl:value-of
> select="$eckpunkte"/></xsl:attribute>
> <xsl:attribute name="style"><xsl:value-of
> select="'fill:none;stroke:red'"/></xsl:attribute>
> </xsl:element>
>
> </xsl:if>
>
> </xsl:template>
>
> <xsl:template name="Bauteil"
> match="Bauteil[parent::Bauteil_Liste/parent::Gebaeude/@ID=$gebaeudeId]">
>
> <!-- Dieses Template zeichnet die Wdnde und Treppen des Raumes -->
> <xsl:variable name="bauteilId" select="@ID"/>
> <xsl:variable name="partOfStockwerk">
> <xsl:for-each
>
select="/Bauvorhaben/Gebaeude[@ID=$gebaeudeId]/Stockwerk_Liste/Stockwerk[@ID=
$stockwerkId]//bauteil_id">
>
> <xsl:if test="$bauteilId=.">
> <xsl:value-of select="yes"/>
> </xsl:if>
> </xsl:for-each>
> </xsl:variable>
>
> <!--*****************************************************************
> PROCESSOR NEVER REACHES THIS LINE. THE FOLLOWING IF IS NEVER
> EXECUTED! WHY?
> ******************************************************************-->
>
> <xsl:if test="$partOfStockwerk='yes'">
> <xsl:value-of select="'In Ordnung'"/>
> </xsl:if>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Bauvorhaben.xml
>
=============================================================================
=========
>
>
=============================================================================
==========
>
> <?xml version="1.0"?>
> <Bauvorhaben ID="1">
> <bezeichnung>Bauvorhaben</bezeichnung>
> <bundesland>Hessen</bundesland>
> <strasse>Petersenstrasse 15</strasse>
> <plz>64289</plz>
> <stadt>Darmstadt</stadt>
> <Grundstueck_Liste>
> <Grundstueck ID="5">
> <bezeichnung>Grundst|ck 5</bezeichnung>
> <einfuegepunkt>
> <k1>7.883754</k1>
> <k2>-60.170000</k2>
> <k3>0.000000</k3>
> </einfuegepunkt>
> <direction>
> <k1>1</k1>
> <k2>0</k2>
> <k3>0</k3>
> </direction>
> <basisflaeche>
> <eckpunkt>
> <k1>0.000000</k1>
> <k2>0.000000</k2>
> <k3>0.000000</k3>
> </eckpunkt>
> <eckpunkt>
> <k1>87.870000</k1>
> <k2>0.000000</k2>
> <k3>0.000000</k3>
> </eckpunkt>
> <eckpunkt>
> <k1>87.870000</k1>
> <k2>64.050000</k2>
> <k3>0.000000</k3>
> </eckpunkt>
> <eckpunkt>
> <k1>0.000000</k1>
> <k2>64.050000</k2>
> <k3>0.000000</k3>
> </eckpunkt>
> </basisflaeche>
> <Gebaeude_ID_Liste>
> <Gebaeude_ID>1074492688</Gebaeude_ID>
> </Gebaeude_ID_Liste>
> </Grundstueck>
> </Grundstueck_Liste>
> <Gebaeude ID="1074492688" bauvorhaben_id="1" grundstueck_id="5">
> <bezeichnung>Geschaeftshaus</bezeichnung>
> <typ>Wohngebaeude</typ>
> <Stockwerk_Liste>
> <Stockwerk ID="1076002008">
> <bezeichnung>4.OG</bezeichnung>
> <flaeche>904.936500</flaeche>
> <Nutzungszonen_Liste>
> <Nutzungszone ID="1076254944">
> <bezeichnung>Zone_1</bezeichnung>
> <nutzung>arbeiten</nutzung>
> <flaeche>265.822500</flaeche>
> <Raum_Liste>
> <Raum ID="1076254872">
> <Nutzungseinheit>
> <anzahlPersonen>0</anzahlPersonen>
> <nutzung>Verkauf</nutzung>
> </Nutzungseinheit>
> <bezeichnung>Supermarkt</bezeichnung>
> <flaeche>143.477500</flaeche>
> <hoehe>2.500000</hoehe>
> <rotation>0.000000</rotation>
> <direction>
> <k1>1.000000</k1>
> <k2>0.000000</k2>
> <k3>0.000000</k3>
> </direction>
> <normal>
> <k1>0.000000</k1>
> <k2>0.000000</k2>
> <k3>1.000000</k3>
> </normal>
> <einfuegepunkt>
> <k1>66.903754</k1>
> <k2>-25.270000</k2>
> <k3>0.250000</k3>
> </einfuegepunkt>
> <basisflaeche>
> <eckpunkt>
> <k1>0.000000</k1>
> <k2>0.000000</k2>
> </eckpunkt>
> <eckpunkt>
> <k1>6.400000</k1>
> <k2>0.000000</k2>
> </eckpunkt>
> <eckpunkt>
> <k1>6.400000</k1>
> <k2>19.600000</k2>
> </eckpunkt>
> <eckpunkt>
> <k1>3.250000</k1>
> <k2>19.600000</k2>
> </eckpunkt>
> <eckpunkt>
> <k1>3.250000</k1>
> <k2>25.150000</k2>
> </eckpunkt>
> <eckpunkt>
> <k1>0.000000</k1>
> <k2>25.150000</k2>
> </eckpunkt>
> </basisflaeche>
> <Bauteil_id_Liste>
> <bauteil_id>1076000432</bauteil_id>
> <bauteil_id>1076001168</bauteil_id>
> <bauteil_id>1076000440</bauteil_id>
> <bauteil_id>1076001288</bauteil_id>
> <bauteil_id>1076001296</bauteil_id>
> <bauteil_id>1076001304</bauteil_id>
> </Bauteil_id_Liste>
> </Raum>
> <Raum ID="1076254856">
> ...
> </Raum>
> </Raum_Liste>
> </Nutzungszone>
> <Nutzungszone ID="1076254960">
> ...
> </Nutzungszone>
> </Nutzungszonen_Liste>
> </Stockwerk>
> </Stockwerk_Liste>
> <Bauteil_Liste>
> <Bauteil ID="1076000080">
> ...
> </Bauteil>
> <Bauteil ID="1076000088">
> ...
> </Bauteil>
> ...
> </Bauteil_Liste>
> <Dach_Liste/>
> </Gebaeude>
> </Bauvorhaben>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] processor never reaches o, Michael Kay | Thread | RE: [xsl] A sequence of more than o, Mukul Gandhi |
| RE: [xsl] processor never reaches o, Michael Kay | Date | RE: [xsl] A sequence of more than o, Mukul Gandhi |
| Month |