mario: Gültiger XPATH Ausdruck verursacht Fehler (XSLT)

Beitrag lesen

Hallöchen allerseits,

Ich möchte eine XML Transformaion mit XSLT durchführen. Ich habe folgende Source-Datei:

  
<?xml version="1.0" encoding="UTF-8"?>  
<?xml-stylesheet href="test.xsl" type="text/xsl" ?>  
<uiModel>  
    <cuiModel id="Home" name="Home">  
        <window id="container" name="container"  
             width="" height="" bgColor="" repetition="">  
            <gridBagBox id="grid_bag_box" name="grid_bag_box"  
                gridHeight="" gridWidth="">  
                <constraint gridx="" gridy="" gridwidth=""  
                    gridheight="" weightx="" weighty=""  
                    fill="" insets="">  
                    <box id="headerBox" width="" height="" bgImage="" bgColor="" isVisible="">  
                <imageComponent id="logo" imageHeight="" imageWidth="" imageBorder="" isVisible=""/>  
                         <outputText id="hdText" name="hdText" isVisible="" isEnabled=""  
                                     isBold="" textMargin="" context="" textFont="" textSize=""  
                                     textColor="" isItalic="" isUnderlined="" content=""/>  
                         <imageComponent id="betaVersion" imageHeight="" imageWidth="" imageBorder="" isVisible=""/>  
                    </box>  
                </constraint>  
             </gridBagBox>  
        </window>  
    </cuiModel>  
</uiModel>  

und folgende XSL Datei:

  
<?xml version="1.0" encoding="ISO-8859-1"?>  
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  
 <xsl:template match="node()|@*">  
  <xsl:copy>  
   <xsl:apply-templates select="node()|@*"/>  
  </xsl:copy>  
 </xsl:template>  
  
       <xsl:template match="//*[@id='map']/../../@gridwidth">  
            <xsl:attribute name="gridwidth">3</xsl:attribute>  
       </xsl:template>  
</xsl:stylesheet>  

Wenn ich die XSL auf die Source XML loslasse, knallt es bei der XPATH Anweisung im 2. templatematch-tag "//*[@id='map']/../../@gridwidth"

Ziel des ganzen ist es die Source XML zu kopieren und nur ein attribut wert zu ändern. In diesem konkreten Beispiel wäre es die gridwidth des constraints tags, in welcher das Element mit der id='map' ist.

Ich kann das Auftreten des Fehlers nicht ganz nachvollziehen, zumal der XPATH Ausdruck "//*[@id='map']/../../@gridwidth" voll und ganz korrekt ist!

Kann mir hier vielleicht jemand weiterhelfen?

Vielen DAnk im Voraus,
Mario