When I test a policy in Simulator, which does a query, I hate having to
have the Query result handy (actually I hate more that it does not
persist between Simulator runs, the way the source event doc does).

So to save time, I wanted to add a rule at the top, Set Variables, that
sets my QUERY variable to the <instance> doc results.

But there is something 'funny' about exactly how
Set Local Variable TEST as a nodeset to Query source for something

stores that nodeset. I know the <nds> <output> nodes get dropped, and
that the XPATH of:
$QUERY/attr[@attr-name='whatever'] works.

And I recall if I trace it out, I see it as if the <instance> node is
the parent node inside the variable.

If I get this Query result back:
<nds dtdversion="4.0" ndsversion="8.x">
<product version="?.?.?.?">DirXML</product>
<contact>Novell, Inc.</contact>
<instance class-name="User" src-dn="o\ou\dn">
<attr attr-name="co">
<value type="string">help</value>

into my variable, then XML Serialize and trace it, I see:

<instance class-name="User" src-dn="o\ou\dn">
<attr attr-name="co">
<value type="string">help</value>

Ok, that is all background.

So for testing, I wanted to make a local variable, QUERY, by XML Parse
the literal text string of:
<instance class-name="User" src-dn="o\ou\dn">
<attr attr-name="co">
<value type="string">help</value>

When I do that, the XPATH of

does not work. I need to use a double slash before attr:

or specify the <instance> node as:

So I am wondering, how can I, without querying, make a variable that
looks like the variable the engine will make from a query result for

I tried, just:
<attr attr-name="co">
<value type="string">help</value>

with no luck.

I prefer to not have to go back and fix the code for real world after
testing is over. (I know that $QUERY//attr[@attr-name='whatever'] will
work in both cases, which is what I am using in the interim, but would
prefer not to incur the theoretical performance penalty that //

BraveBraveSirRobin's Profile: https://forums.netiq.com/member.php?userid=2812
View this thread: https://forums.netiq.com/showthread.php?t=46157