1

I made the following sentence:

For example div[@id=”content” or contains(@class,”content”)] can be used to identify a node that the value of its id attribute is “content” or the value of its class attribute contains “content”.

I would like to know "a node that" is correct or I should say "a node which", if I want to use "which", how can I avoid using "its" (italic) in the sentence above?

2

The answer is neither.

The problem is (that) you tried to use that as a relative pronoun, but you have nothing to relate the two clauses.


Let's take a closer look at your sentence.

For example div[@id=”content” or contains(@class,”content”)] can be used to show a node that the value of its id attribute is “content” or the value of its class attribute contains “content”.

This could look like that relates to its, but actually it does not.

Let's try something simpler:

Two sentences: This is a cat. This cat sleeps a lot.
One complex sentence: This is the cat that sleeps a lot.
​                (= This is a the cat this cat that sleeps a lot.)

That's how a relative pronoun works in general. It has to replace something in the subordinated clause, usually either the subject or the object of the subordinated clause.


So, how should we fix your sentence?

My first thought was to use that as a subordinating conjunction instead (to show [that ...]), but according to the intended meaning, to obtain fits the sentence better. (For the sake of simplicity, I'll assume that we will obtain only one node.) So, let's consider the whole idea (with the verb to obtain) as two sentences first:

  1. For example, div[@id=”content” or contains(@class,”content”)] can be used to obtain a node.
  2. The value of the attribute id of this node is “content” or the value of the attribute class (of this node) contains “content”.

Fix #1: Use of which

An obvious way to join the two sentences is to use which in the place of node in the subordinate clause (sentence 2). The result will look like this:

For example, div[@id=”content” or contains(@class,”content”)] can be used to obtain the node of which the value of the attribute id is “content” or the value of the attribute class contains “content”.

Fix #2: Use whose

Though of which is possible, it's more common to simply use whose. Whose is corresponding to its in the subordinated clause, which is the OP's original problem. Using whose instead of of which, we get this:

For example, div[@id=”content” or contains(@class,”content”)] can be used to obtain the node whose the value of attribute id is “content” or the value of attribute class contains “content”.

But, wait! We can even make it a little better:

For example, div[@id=”content” or contains(@class,”content”)] can be used to obtain the node whose either the value of attribute id is or the value of attribute class contains “content”.

  • Thank you very much, but I think the sentence you suggested is not what I mean. I want to say "For example div[@id=”content” or contains(@class,”content”)] can be used to identify or distinguish a node that the value of its id attribute is “content” or the value of its class attribute contains “content” ". Suppose there are many nodes, and this expression is used to identify a specific node – Ahmad Jun 14 '15 at 14:43
  • Excuse me, in my question I modified "show" to "identify" and I think it can be a relative clause – Ahmad Jun 14 '15 at 14:45
  • @Ahmad It depends on the meaning you want to say. If you replaced show with identify in the last fix in my answer, it would work, but I think it's still not what you want. Seeing your comment, I think you probably want this: For example, div[@id=”content” or contains(@class,”content”)] can be used to obtain the node(s) whose either the value of the attribute id is (“content”) or the value of the attribute class contains “content”. (The first "content" can be omitted.) Does that sound right for you? – Damkerng T. Jun 14 '15 at 14:48
  • Yes that sounds right, you suggest to use "whose" and removing "its", no matter where it is? because my problem was how to omit "its" while there is a distance between "that" and "its" – Ahmad Jun 14 '15 at 15:01
  • Yes. The main point is that you have to have something to relate the two clauses, i.e. the relative pronoun must stand for (or replace) something in the subordinated clause. In your case, it's its. I will edit my answer to accommodate your intended meaning. – Damkerng T. Jun 14 '15 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.