@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(" + "( local-name() = 'input' and @type = 'submit' ) or " + "( local-name() = 'button' and (@type = 'submit' or not(@type)) )" + ")]"); }
@Override public String mergeIntoExpression(String sourceXPathExpression) { return merge(sourceXPathExpression, this.xPathExpression); }
@Override public String mergeExpressionAsCondition(String sourceXPathExpression) { return mergeAsCondition(sourceXPathExpression, this.xPathExpression); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(" + "( local-name() = 'input' and @type = 'submit' ) or " + "( local-name() = 'button' and (@type = 'submit' or not(@type)) )" + ")]"); }
@Override public String mergeIntoExpression(String sourceXPathExpression) { return merge(sourceXPathExpression, this.xPathExpression); }
@Override public String mergeExpressionAsCondition(String sourceXPathExpression) { return mergeAsCondition(sourceXPathExpression, this.xPathExpression); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { // [last() = 1] will not suffice because it may be composed into an expression like //a[last() = 1] which will yield wrong results // So you have to go up and then down again: //a[../*[last() = 1]] return new ConditionSimpleComponent("[../*[last() = 1]]"); }
@Override public String mergeIntoExpression(String sourceXPathExpression) { if ("*".equals(this.xPathExpression)) { return ConditionSimpleComponent.merge(sourceXPathExpression, "["+ MATCH_EVERYTHING_XPATH_CONDITIONAL+"]"); } return ConditionSimpleComponent.merge(sourceXPathExpression, "[self::"+ this.xPathExpression +"]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { // [last() = 1] will not suffice because it may be composed into an expression like //a[last() = 1] which will yield wrong results // So you have to go up and then down again: //a[../*[last() = 1]] return new ConditionSimpleComponent("[../*[last() = 1]]"); }
@Override public String mergeIntoExpression(String sourceXPathExpression) { if ("*".equals(this.xPathExpression)) { return ConditionSimpleComponent.merge(sourceXPathExpression, "["+ MATCH_EVERYTHING_XPATH_CONDITIONAL+"]"); } return ConditionSimpleComponent.merge(sourceXPathExpression, "[self::"+ this.xPathExpression +"]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(" + "(self::input and translate(@type,'BUTTON','button') = 'button') " + "or " + "self::button" + ")]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(" + "(self::input and translate(@type,'BUTTON','button') = 'button') " + "or " + "self::button" + ")]"); }
public static ConditionSimpleComponent nthChild(int a, int b) { // a == 0: 0n+b 0n-b if (a == 0) { return new ConditionSimpleComponent("[position() = " + b + "]"); } // a < 0: -an+b -an-b if (a < 0) { return new ConditionSimpleComponent("[(position() - " + b + ") mod " + a + " = 0 and position() <= " + b + "]"); } // a > 0: an+b an-b return new ConditionSimpleComponent("[(position() - " + b + ") mod " + a + " = 0 and position() >= " + b + "]"); }
public static ConditionSimpleComponent nthChild(int a, int b) { // a == 0: 0n+b 0n-b if (a == 0) { return new ConditionSimpleComponent("[position() = " + b + "]"); } // a < 0: -an+b -an-b if (a < 0) { return new ConditionSimpleComponent("[(position() - " + b + ") mod " + a + " = 0 and position() <= " + b + "]"); } // a > 0: an+b an-b return new ConditionSimpleComponent("[(position() - " + b + ") mod " + a + " = 0 and position() >= " + b + "]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(local-name() = 'input' or local-name() = 'button' or local-name() = 'select' or local-name() = 'textarea')]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent(); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("["+DISABLED_XPATH_CONDITION+"]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(self::input and @type = '" + typeAttributeValue + "')]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[count(.//*) = 0]"); }
@Override public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) { return new ConditionSimpleComponent("[(local-name() = 'input' or local-name() = 'button' or local-name() = 'select' or local-name() = 'textarea')]"); }