473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

simple XPATH question

Hi All, this is fairly simple, but I am a noob. Take a look at this:

<entry dn="CN=JB01,OU=Domain Controllers,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
<oc-value>computer</oc-value>
</objectclass>
<entry dn="CN=Joe Black,OU=Managed
Users,OU=GROUPER,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
</objectclass>

I am trying to retrieve the attribute dn by checking the different
objectclass/oc-value, but I only want to select it if it is only a
user, not a user and a computer. Any ideas?

Thanks
woody

Jul 20 '05 #1
3 1083


wo*********@gmail.com wrote:
Hi All, this is fairly simple, but I am a noob. Take a look at this:

<entry dn="CN=JB01,OU=Domain Controllers,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
<oc-value>computer</oc-value>
</objectclass>
<entry dn="CN=Joe Black,OU=Managed
Users,OU=GROUPER,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
</objectclass>

I am trying to retrieve the attribute dn by checking the different
objectclass/oc-value, but I only want to select it if it is only a
user, not a user and a computer. Any ideas?


Assuming a root element
/root/entry[objectclass/oc-value = 'user' and
not(objectclass/oc-value = 'computer')]/@dn
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
wo*********@gmail.com wrote:
Hi All, this is fairly simple, but I am a noob. Take a look at this:

<entry dn="CN=JB01,OU=Domain Controllers,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
<oc-value>computer</oc-value>
</objectclass>
<entry dn="CN=Joe Black,OU=Managed
Users,OU=GROUPER,DC=www,DC=site,DC=org">
<objectclass>
<oc-value>top</oc-value>
<oc-value>person</oc-value>
<oc-value>organizationalPerson</oc-value>
<oc-value>user</oc-value>
</objectclass>

I am trying to retrieve the attribute dn by checking the different
objectclass/oc-value, but I only want to select it if it is only a
user, not a user and a computer. Any ideas?

Thanks
woody

<xsl:template
match="entry[objectclass/oc-value[.='user']][objectclass/oc-value[not(.='computer')]]/@dn"/>
<xsl:value-of select="."/>
</xsl:match>

To make it more obvious, it is
match="entry[][]/@dn"
with these two conditions
1. [objectclass/oc-value[.='user']
2. [objectclass/oc-value[not(.='computer')]]

HTH
Volkm@r
Jul 20 '05 #3
Wonderful, thank you very much.

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joshua Beall | last post by:
Hi All, I have a task that should be very simple but I'm running into trouble. All I want to do is query a document using XPath, and save the resulting XML in a string. Here's that I am trying...
0
by: gael.pegliasco | last post by:
Hi, How are you dear and nice helper :) ? I'm trying to test xpath with this simple program : import xml.dom.minidom from xml.xpath.Context import Context import xml.xpath
9
by: Jon Thackray | last post by:
I'm trying to use XPath to enable me to number items within sections in a paper. I have so far tried about ten things, all of which it seemed to me should work, and none of which do. Essentially...
3
by: Kathy Burke | last post by:
Hi again, I'm using the following xpath (works in visualizer) with a SelectSingleNode("xpath") statement. //Station/(WI])]/@order Problem is I get an error "expression passed to this method...
7
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned...
6
by: Tommy | last post by:
For a XML fragment like below <ns0:BusCar_Request xmlns:ns0="http://BTSDG_SQL"> <ns0:sync> <ns0:after> <ns0:BusinessCards NameOnCard="NameOnCard_1" TitleOnCard="TitleOnCard_1" Quantity="10" />...
9
by: David Thielen | last post by:
Hi; I am sure I am missing something here but I cannot figure it out. Below I have a program and I cannot figure out why the xpath selects that throw an exception fail. From what I know they...
5
by: Gnic | last post by:
Hi , I have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa>
6
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.