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

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

Subject: RE: [xsl] Parse a variable which contains a tree-fragment
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 22 Jan 2004 00:01:44 +0100

> -----Original Message-----
> From: Gerald Fingerlos
> 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?

Not only that, I'm curious as to where the add-attr comes from...
(do you mean 'xsl:attribute'?)

A bit of context would be helpful in any case.



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

Current Thread