cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
756
Views
5
Helpful
2
Replies

XPath string() function not working

DaSt-1986
Level 1
Level 1

I'm trying to create a template-based service that sets specific content. I have the following now;

 

<config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="location-vlan">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <?foreach {../../location:location[code=string(/location)]/location:device}?>
    <device>
      <name>{name}</name>
      <config>
        <hostname xmlns="urn:ios">{../../ncs:devices/ncs:device[name=string(name)]/ncs:authgroup}</hostname>
        <!-- Remove the following -->
        <ip xmlns="urn:ios">
          <domain>
            <name>{string(name)}</name>
          </domain>
        </ip>
        <!-- / -->
      </config>
    </device>
    <?end?>
  </devices>
</config-template>

The 'string(name)' on the domain part is working perfectly, but on the hostname part it isn't. When I replace the 'string(name)' on the hostname part with a litteral hostname (like 'dm-vsw-bhn-001') it works perfectly.

 

What am I doing wrong?

 

Daryl

1 Accepted Solution

Accepted Solutions

yfherzog
Cisco Employee
Cisco Employee

Can't promise anything, but try replacing [name=string(name)] with [name=current()/name]

 

Try using commit dry-run | debug template to find any clues on what might not be working as expected.

View solution in original post

2 Replies 2

yfherzog
Cisco Employee
Cisco Employee

Can't promise anything, but try replacing [name=string(name)] with [name=current()/name]

 

Try using commit dry-run | debug template to find any clues on what might not be working as expected.

That did the trick! Thank you

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: