Knowledge Partner
Knowledge Partner
103 views

Re: Iterating through list of values for same xml name

XPath("add-attr[@attr-name='uniqueID']/value[1]

is semantically the same as:

XPath("add-attr[@attr-name='uniqueID']/value[position()=1]

Actually [1] is shorthand for [position()=1]

therefore if [$counter] is not working, I use:
[position()=$counter]

Which I think is what you are asking for.

On 6/21/2012 12:56 PM, iceman3 wrote:
>
> I am trying to go through multiple values and populate each one to a
> group membership. I can call each value tag with Global Configuration
> Value("GroupPlacement")+"\"+XPath("add-attr[@attr-name='CN']/value")+"\"+XPath("add-attr[@attr-name='uniqueID']/value[1]")
> changing the [1] to [2] etc for each value. As I will be seeing 1000's
> of these I wanted to change the number to a counter. I have the
> following but it just picks up the first value.
>
> <do-set-local-variable name="finalcount" scope="policy">
> <arg-string>
> <token-xpath expression="1"/>
> </arg-string>
> </do-set-local-variable>
> <do-for-each>
> <arg-node-set>
> <token-xpath expression="add-attr[@attr-name='uniqueID']"/>
> </arg-node-set>
> <arg-actions>
> <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['$finalcount']"/>
> </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 name="finalcount" scope="policy">
> <arg-string>
> <token-xpath expression="1+$finalcount"/>
> </arg-string>
> </do-set-local-variable>
> </arg-actions>
> </do-for-each>
>
> Also, is there another way like using the xslt position() in here for
> simplicity through policy builder?
>
> Thanks,
>
>



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.