<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic XPath string() function not working in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954026#M4479</link>
    <description>&lt;P&gt;I'm trying to create a template-based service that sets specific content. I have the following now;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="location-vlan"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
    &amp;lt;?foreach {../../location:location[code=string(/location)]/location:device}?&amp;gt;
    &amp;lt;device&amp;gt;
      &amp;lt;name&amp;gt;{name}&amp;lt;/name&amp;gt;
      &amp;lt;config&amp;gt;
        &amp;lt;hostname xmlns="urn:ios"&amp;gt;{../../ncs:devices/ncs:device[name=string(name)]/ncs:authgroup}&amp;lt;/hostname&amp;gt;
        &amp;lt;!-- Remove the following --&amp;gt;
        &amp;lt;ip xmlns="urn:ios"&amp;gt;
          &amp;lt;domain&amp;gt;
            &amp;lt;name&amp;gt;{string(name)}&amp;lt;/name&amp;gt;
          &amp;lt;/domain&amp;gt;
        &amp;lt;/ip&amp;gt;
        &amp;lt;!-- / --&amp;gt;
      &amp;lt;/config&amp;gt;
    &amp;lt;/device&amp;gt;
    &amp;lt;?end?&amp;gt;
  &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daryl&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2019 14:20:17 GMT</pubDate>
    <dc:creator>DaSt-1986</dc:creator>
    <dc:date>2019-11-06T14:20:17Z</dc:date>
    <item>
      <title>XPath string() function not working</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954026#M4479</link>
      <description>&lt;P&gt;I'm trying to create a template-based service that sets specific content. I have the following now;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="location-vlan"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
    &amp;lt;?foreach {../../location:location[code=string(/location)]/location:device}?&amp;gt;
    &amp;lt;device&amp;gt;
      &amp;lt;name&amp;gt;{name}&amp;lt;/name&amp;gt;
      &amp;lt;config&amp;gt;
        &amp;lt;hostname xmlns="urn:ios"&amp;gt;{../../ncs:devices/ncs:device[name=string(name)]/ncs:authgroup}&amp;lt;/hostname&amp;gt;
        &amp;lt;!-- Remove the following --&amp;gt;
        &amp;lt;ip xmlns="urn:ios"&amp;gt;
          &amp;lt;domain&amp;gt;
            &amp;lt;name&amp;gt;{string(name)}&amp;lt;/name&amp;gt;
          &amp;lt;/domain&amp;gt;
        &amp;lt;/ip&amp;gt;
        &amp;lt;!-- / --&amp;gt;
      &amp;lt;/config&amp;gt;
    &amp;lt;/device&amp;gt;
    &amp;lt;?end?&amp;gt;
  &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daryl&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 14:20:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954026#M4479</guid>
      <dc:creator>DaSt-1986</dc:creator>
      <dc:date>2019-11-06T14:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: XPath string() function not working</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954067#M4480</link>
      <description>&lt;P&gt;Can't promise anything, but try replacing [name=string(name)] with [name=current()/name]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using commit dry-run | debug template to find any clues on what might not be working as expected.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 15:16:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954067#M4480</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2019-11-06T15:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: XPath string() function not working</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954193#M4481</link>
      <description>&lt;P&gt;That did the trick! Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 17:36:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-string-function-not-working/m-p/3954193#M4481</guid>
      <dc:creator>DaSt-1986</dc:creator>
      <dc:date>2019-11-06T17:36:48Z</dc:date>
    </item>
  </channel>
</rss>

