Knowledge Partner
Knowledge Partner
170 views

Re: Iterating through list of values for same xml name

XPATH is NOT XSLT. XSLT is not XPATH.

XPATH is a way of describing XML Path references and is often used by
XSLT (or IDM in this context).

Therefore defining a variable, using XSLT will not work.

<do-set-local-variable name="thisvalue" scope="policy">
<arg-string>
<token-xpath expression='<xsl:number format="1" from="@value"/>'/>
</arg-string>
</do-set-local-variable>


Also the next set dest attr will not work as you want in this one:
<do-set-dest-attr-value class-name="Group" name="Group Membership"
when="before">
<arg-value type="string">
<token-global-variable name="GroupPlacement"/>
<token-text xml:space="preserve">\</token-text>
<token-xpath expression="add-attr[@attr-name='CN']/value"/>
<token-text xml:space="preserve">\</token-text>
<token-xpath expression="add-attr[@attr-name='uniqueID']/value"/>
<token-text xml:space="preserve">[</token-text>
<token-text xml:space="preserve">$thisvalue$</token-text>
<token-text xml:space="preserve">]</token-text>
</arg-value>
</do-set-dest-attr-value>

As this line, will not work. Use the local variable tag instead.

<token-text xml:space="preserve">$thisvalue$</token-text>

which would look like:

<token-local-variable name="thisvalue"/>

Also, I think what you really need to learn about here is the very cool
special variable current-node, which is only available in a for-each loop.

So since you are looping over the UniqueID values, then current-node
should have the current value being looped over.

Consider this series of articles for some hints that will for sure help you.

http://www.novell.com/communities/node/13053/common-mistakes-newcomers-idm-make-part-1
http://www.novell.com/communities/node/13057/common-mistakes-newcomers-idm-make-part-2
http://www.novell.com/communities/node/13058/common-mistakes-newcomers-idm-make-part-3
http://www.novell.com/communities/node/13125/common-mistakes-newcomers-idm-make-part-4
http://www.novell.com/communities/node/13126/common-mistakes-newcomers-idm-make-part-5
http://www.novell.com/communities/node/13302/common-mistakes-newcomers-idm-make-part-6
http://www.novell.com/communities/node/13316/common-mistakes-newcomers-idm-make-part-7
http://www.novell.com/communities/node/13347/common-mistakes-newcomers-idm-make-part-8
http://www.novell.com/communities/node/13383/common-mistakes-newcomers-idm-make-part-9
http://www.novell.com/communities/node/13486/common-mistakes-newcomers-idm-make-part-10
http://www.novell.com/communities/node/13493/common-mistakes-newcomers-idm-make-part-11

If you are short on time specific to your problems,
#1, #3, #5, maybe a little of #9.

Good reading nonetheless, and I guarentee you will learn at least
something. (Or else learn to hate my inability to shut up).




On 6/25/2012 10:46 AM, iceman3 wrote:
>
> I am getting a literal error with the variable declaration and do not
> know why: below is the code:
>
> <do-for-each>
> <arg-node-set>
> <token-xpath expression="add-attr[@attr-name='uniqueID']/value"/>
> </arg-node-set>
> <arg-actions>
> <do-set-local-variable name="thisvalue" scope="policy">
> <arg-string>
> <token-xpath expression='<xsl:number format="1"
> from="@value"/>'/>
> </arg-string>
> </do-set-local-variable>
> <do-set-dest-attr-value class-name="Group" name="Group Membership"
> when="before">
> <arg-value type="string">
> <token-global-variable name="GroupPlacement"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath expression="add-attr[@attr-name='CN']/value"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath expression="add-attr[@attr-name='uniqueID']/value"/>
> <token-text xml:space="preserve">[</token-text>
> <token-text xml:space="preserve">$thisvalue$</token-text>
> <token-text xml:space="preserve">]</token-text>
> </arg-value>
> </do-set-dest-attr-value>
> <do-set-dest-attr-value class-name="Group" disabled="true"
> name="Group Membership">
> <arg-value type="string">
> <token-global-variable name="GroupPlacement"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath expression="add-attr[@attr-name='CN']/value"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath
> expression="add-attr[@attr-name='uniqueID']/value[2]"/>
> </arg-value>
> </do-set-dest-attr-value>
> <do-set-dest-attr-value class-name="Group" disabled="true"
> name="Group Membership">
> <arg-value type="string">
> <token-global-variable name="GroupPlacement"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath expression="add-attr[@attr-name='CN']/value"/>
> <token-text xml:space="preserve">\</token-text>
> <token-xpath
> expression="add-attr[@attr-name='uniqueID']/value[3]"/>
> </arg-value>
> </do-set-dest-attr-value>
> <do-clone-op-attr dest-name="Security Equals" src-name="Group
> Membership"/>
> <do-set-local-variable disabled="true" name="finalcount"
> scope="policy">
> <arg-string>
> <token-xpath expression="$finalcount+1"/>
> </arg-string>
> </do-set-local-variable>
> </arg-actions>
> </do-for-each>
>
>



Labels (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.