[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Parse a variable which contains a tree-fragment


Subject: [xsl] Parse a variable which contains a tree-fragment
From: "Gerald Fingerlos" <gerald@xxxxxxxxxxxx>
Date: Wed, 21 Jan 2004 23:09:06 +0100

My problem is as follows:
 
I have a variable $result which contains the following
value/tree-fragment:
 
<root>
    <output>
        <instance class-name="User" src-dn="\XY\EMA\G2 F2">
            <attr attr-name="manager">
                <value type="dn">\xy\EMA\test1\G1 F1</value>
            </attr>
        </instance>
        <instance class-name="User" src-dn="\XY\EMA\G1 F1">
        </instance>
    </output>
</root>
 
What I want to do is to select the src-dn if there is _no_ "attr
attr-name='manager'"
In this case, the result should be "\XY\EMA\G1 F1"
 
I tried it with the following stylesheet:
 
<xsl:choose>
    <xsl:when test="$result//attr[@attr-name]='manager'"/>
    <xsl:otherwise>
    <add-attr attr-name="manager">
        <value>
            <xsl:value-of select="="$result//@src-dn"/>
        </value>
    </add-attr>
    </xsl:otherwise>
</xsl:choose>
 
But obviously this doesnt work because the value-of select chooses the
first available one.
Can anyone give me a hint how this could be corrected?
 
Thank you in advance,
Gerald
 
 

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



Current Thread