I'm splitting homePostalAddress in to its components here and can't quite
get something that seems like it ought to be simple to work in xpath.
homePostalAddress is a structured attribute that contains six components
as strings, but not all of them have to contain actual information. I
only want the components that contain at least one character (regex: ".*
[A-Za-z0-9]+.*").

So if-op-attr available, I'm stuffing it in to a nodeset (to handle the
difference in the way <modify> and <add> events come through):

<do-set-local-variable name="homeAddr" scope="policy">
<arg-node-set>
<token-op-attr name="homePostalAddress"/>
</arg-node-set>
</do-set-local-variable>

What I thought I wanted to do next was test each component, and if found
to contain something, use the something:

<do-if>
<arg-conditions>
<and>
<if-xpath op="true">$homeAddr/component[1]=".*[A-Za-z0-9]+.*"</if-
xpath>
</and>
</arg-conditions>
<arg-actions>
<do-set-dest-attr-value name="Home_Address_1">
<arg-value>
<token-xpath expression="$homeAddr/component[1]"/>
</arg-value>
</do-set-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>

But the if-xpath is never true.


I worked around this with:

<do-set-local-variable name="hpa1" scope="policy">
<arg-string>
<token-xpath expression="$homeAddr/component[1]"/>
</arg-string>
</do-set-local-variable>

<do-if>
<arg-conditions>
<and>
<if-local-variable mode="regex" name="hpa1" op="equal">.*[A-Za-z0-9]
+.*</if-local-variable>
</and>
</arg-conditions>
<arg-actions>
<do-set-dest-attr-value name="Home_Address_1">
<arg-value>
<token-xpath expression="$homeAddr/component[1]"/>
</arg-value>
</do-set-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>

which works, but just seems like I shouldn't have to do it that way. I
know the regex I'm using works, since it works when used with the local
variable, but I can't figure out how to get the xpath expression test to
use it.

What am I missing here?


--
---------------------------------------------------------------------------
David Gersic dgersic_@_niu.edu
Novell Knowledge Partner http://forums.novell.com

Please post questions in the newsgroups. No support provided via email.