} else if (eq("only-of-type", pseudoClass)) {
xpath = "not(preceding-sibling::" + tag + " or following-sibling::" + tag
+ ")";
} else if (eq("nth-child", pseudoClass)) {
if (!eq("n", pseudoClass)) {
Sequence sequence = SelectorEngineJS.getSequence(pseudoValue);
if (sequence != null) {
if (sequence.start == sequence.max) {
xpath = "count(preceding-sibling::*) = " + (sequence.start - 1);
} else {
xpath = "(count(preceding-sibling::*) + 1) mod " + sequence.add
+ " = " + sequence.modVal
+ ((sequence.start > 1) ? " and count(preceding-sibling::*) >= "
+ (sequence.start - 1) : "") + ((sequence.max > 0) ?
" and count(preceding-sibling::*) <= " + (sequence.max - 1)
: "");
}
}
}
} else if (eq("nth-of-type", pseudoClass)) {
if (!pseudoValue.startsWith("n")) {
Sequence sequence = SelectorEngineJS.getSequence(pseudoValue);
if (sequence != null) {
if (sequence.start == sequence.max) {
xpath = pseudoValue;
} else {
xpath = "position() mod " + sequence.add + " = " + sequence.modVal