Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

Getting specific values

Hello Experts,

I have xml file which contains id like below...

<test id="test.one:test01:get"/>
<test id="test.two:test02:get"/>
<test id="test.three:test03:getid"/>
<test id="test.four:test04:get"/>
<test id="test.one:test05:setid"/>
<test id="test.one:test09:get"/>
<test id="test.one:test08:getid"/>
<test id="test.one:test06:set"/>

I would like to get only those id which contains :get and nothing else [getid] or :set and not[:setid]

I have done like this but it output setid and getid also

<xsl:if test="contains(@id,':set') or contains(@id,':get')">

Thanks,
Shailesh

can u please suggest xslt code for this.
0
ShaileshShinde
Asked:
ShaileshShinde
  • 2
  • 2
1 Solution
 
Geert BormansCommented:
try this
        <xsl:if test="tokenize(@id, ':') = 'get' or tokenize(@id, ':') = 'set'">
(XSLT2 only)
XSLT1 is easy too if you need that
0
 
ShaileshShindeAuthor Commented:
Hello Expert,

Thanks I will test this and reply you.

--
Shailesh
0
 
ShaileshShindeAuthor Commented:
Thanks Expert
0
 
Geert BormansCommented:
welcome
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now