Skip to content

Instantly share code, notes, and snippets.

@dungtd91
Forked from m-thomson/import-if-syntax.md
Created November 27, 2018 03:54
Show Gist options
  • Select an option

  • Save dungtd91/b6150f4e261d52ccf55221598c3cc674 to your computer and use it in GitHub Desktop.

Select an option

Save dungtd91/b6150f4e261d52ccf55221598c3cc674 to your computer and use it in GitHub Desktop.

Revisions

  1. @m-thomson m-thomson revised this gist Oct 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/) as shown [here](http://www.wpallimport.com/documentation/advanced/if-statements/).

    The `[ELSE]<something>` part is optional
    Note: The `[ELSE]<something>` part is optional


    #### Number is equal to:
  2. @m-thomson m-thomson revised this gist Sep 16, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    ## WP All Import - If statement examples
    ## WP All Import - IF/ELSE statement examples

    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/) as shown [here](http://www.wpallimport.com/documentation/advanced/if-statements/).

    The `[ELSE]<something>` part is optional


    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
    `[IF({price[.=0]})]Zero[ELSE]Not Zero[ENDIF]`

    #### Number is greater than:
    `[IF({price[.>0]})]Greater than 0[ENDIF]`
  3. @m-thomson m-thomson revised this gist Aug 6, 2017. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -4,19 +4,19 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st


    #### Number is equal to:
    `[IF({price[. =0]})]Zero[ENDIF]`
    `[IF({price[.=0]})]Zero[ENDIF]`

    #### Number is greater than:
    `[IF({price[. >0]})]Greater than 0[ENDIF]`
    `[IF({price[.>0]})]Greater than 0[ENDIF]`

    #### Text is equal to:
    `[IF({title[. ='Foo']})]The title is Foo[ENDIF]`
    `[IF({title[.='Foo']})]The title is Foo[ENDIF]`

    #### Text is not equal to:
    `[IF({title[. !='Foo']})]The title is not Foo[ENDIF]`
    `[IF({title[.!='Foo']})]The title is not Foo[ENDIF]`

    #### Text is empty (see note below):
    `[IF({title[. ='']})]The title is empty[ENDIF]`
    `[IF({title[.='']})]The title is empty[ENDIF]`

    #### Text contains:
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`
    @@ -25,6 +25,6 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st
    `[IF({title[string-length()>10]})]{title}[ENDIF]`

    #### IF/ELSE example:
    `[IF({title[. ='']})]The title is empty[ELSE]{title}[ENDIF]`
    `[IF({title[.='']})]The title is empty[ELSE]{title}[ENDIF]`

    **Note**: You might have seen examples using `not(text())` to check for empty fields. While this is valid XPath syntax, it seems to fail *on some servers*. The reasons are unclear. Just use the **Text is empty** syntax above instead.
  4. @m-thomson m-thomson revised this gist Aug 6, 2017. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -4,19 +4,19 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st


    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
    `[IF({price[. =0]})]Zero[ENDIF]`

    #### Number is greater than:
    `[IF({price[.>0]})]Greater than 0[ENDIF]`
    `[IF({price[. >0]})]Greater than 0[ENDIF]`

    #### Text is equal to:
    `[IF({title[.='Foo']})]The title is Foo[ENDIF]`
    `[IF({title[. ='Foo']})]The title is Foo[ENDIF]`

    #### Text is not equal to:
    `[IF({title[.!='Foo']})]The title is not Foo[ENDIF]`
    `[IF({title[. !='Foo']})]The title is not Foo[ENDIF]`

    #### Text is empty (see note below):
    `[IF({title[.='']})]The title is empty[ENDIF]`
    `[IF({title[. ='']})]The title is empty[ENDIF]`

    #### Text contains:
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`
    @@ -25,6 +25,6 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st
    `[IF({title[string-length()>10]})]{title}[ENDIF]`

    #### IF/ELSE example:
    `[IF({title[.= '']})]The title is empty[ELSE]{title}[ENDIF]`
    `[IF({title[. ='']})]The title is empty[ELSE]{title}[ENDIF]`

    **Note**: You might have seen examples using `not(text())` to check for empty fields. While this is valid XPath syntax, it seems to fail *on some servers*. The reasons are unclear. Just use the **Text is empty** syntax above instead.
  5. @m-thomson m-thomson revised this gist Aug 6, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -10,13 +10,13 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st
    `[IF({price[.>0]})]Greater than 0[ENDIF]`

    #### Text is equal to:
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`
    `[IF({title[.='Foo']})]The title is Foo[ENDIF]`

    #### Text is not equal to:
    `[IF({title[text() != 'Foo']})]The title is not Foo[ENDIF]`
    `[IF({title[.!='Foo']})]The title is not Foo[ENDIF]`

    #### Text is empty (see note below):
    `[IF({title[text() = '']})]The title is empty[ENDIF]`
    `[IF({title[.='']})]The title is empty[ENDIF]`

    #### Text contains:
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`
    @@ -25,6 +25,6 @@ Here are some example WP All Import \[IF\] statements. The criteria for an IF st
    `[IF({title[string-length()>10]})]{title}[ENDIF]`

    #### IF/ELSE example:
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
    `[IF({title[.= '']})]The title is empty[ELSE]{title}[ENDIF]`

    **Note**: You might have seen examples using `not(text())` to check for empty fields. While this is valid XPath syntax, it seems to fail *on some servers*. The reasons are unclear. Just use the **Text is empty** syntax above instead.
  6. @m-thomson m-thomson revised this gist Jul 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## WP All Import - If statement examples

    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/) as shown [here](http://www.wpallimport.com/documentation/advanced/if-statements/)
    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/) as shown [here](http://www.wpallimport.com/documentation/advanced/if-statements/).


    #### Number is equal to:
  7. @m-thomson m-thomson revised this gist Jul 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## WP All Import - If statement examples

    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/). See http://www.wpallimport.com/documentation/advanced/if-statements/
    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/) as shown [here](http://www.wpallimport.com/documentation/advanced/if-statements/)


    #### Number is equal to:
  8. @m-thomson m-thomson revised this gist Jul 25, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    ## WP All Import - If statement examples

    Here are some example [IF statements](http://www.wpallimport.com/documentation/advanced/if-statements/). The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In some cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/).
    Here are some example WP All Import \[IF\] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/). See http://www.wpallimport.com/documentation/advanced/if-statements/


    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
  9. @m-thomson m-thomson revised this gist Jun 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ Here are some example [IF statements](http://www.wpallimport.com/documentation/a
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`

    #### Text is not equal to:
    `[IF({title[text() != 'Foo']})]The title is Foo[ENDIF]`
    `[IF({title[text() != 'Foo']})]The title is not Foo[ENDIF]`

    #### Text is empty (see note below):
    `[IF({title[text() = '']})]The title is empty[ENDIF]`
  10. @m-thomson m-thomson revised this gist Jun 30, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,9 @@ Here are some example [IF statements](http://www.wpallimport.com/documentation/a
    #### Text is equal to:
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`

    #### Text is not equal to:
    `[IF({title[text() != 'Foo']})]The title is Foo[ENDIF]`

    #### Text is empty (see note below):
    `[IF({title[text() = '']})]The title is empty[ENDIF]`

  11. @m-thomson m-thomson revised this gist Jun 15, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Here are some example [IF statements](http://www.wpallimport.com/documentation/a
    #### Text is equal to:
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`

    #### Text is empty:
    #### Text is empty (see note below):
    `[IF({title[text() = '']})]The title is empty[ENDIF]`

    #### Text contains:
    @@ -21,4 +21,6 @@ Here are some example [IF statements](http://www.wpallimport.com/documentation/a
    `[IF({title[string-length()>10]})]{title}[ENDIF]`

    #### IF/ELSE example:
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`

    **Note**: You might have seen examples using `not(text())` to check for empty fields. While this is valid XPath syntax, it seems to fail *on some servers*. The reasons are unclear. Just use the **Text is empty** syntax above instead.
  12. @m-thomson m-thomson revised this gist Apr 8, 2017. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    ## WP All Import - If statement examples

    Here are some example [IF statements](http://www.wpallimport.com/documentation/advanced/if-statements/). The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html).

    Although powerful, XPath syntax can be quite complex. In some cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/).
    Here are some example [IF statements](http://www.wpallimport.com/documentation/advanced/if-statements/). The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html). Although powerful, XPath syntax can be quite complex. In some cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/).

    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
  13. @m-thomson m-thomson revised this gist Apr 8, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    ## WP All Import - If statement examples

    Here are some example IF statements. The criteria for an IF statment is written in XPath syntax.
    Here are some example [IF statements](http://www.wpallimport.com/documentation/advanced/if-statements/). The criteria for an IF statment is written in XPath 1.0 syntax and can use [XPath functions](http://www.edankert.com/xpathfunctions.html).

    Although powerful, XPath syntax can be quite complex. In some cases it might be easier to use a [PHP function](http://www.wpallimport.com/documentation/developers/execute-php/).

    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
    @@ -18,7 +20,7 @@ Here are some example IF statements. The criteria for an IF statment is written
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`

    #### Text length is:
    `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]`
    `[IF({title[string-length()>10]})]{title}[ENDIF]`

    #### IF/ELSE example:
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
  14. Mark Thomson renamed this gist Dec 15, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions import-ftp-syntax.md → import-if-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ### WP All Import - If statement examples
    ## WP All Import - If statement examples

    Here are some example IF statements. The criteria for an IF statment is written in XPATH syntax.
    Here are some example IF statements. The criteria for an IF statment is written in XPath syntax.

    #### Number is equal to:
    `[IF({price[.=0]})]Zero[ENDIF]`
  15. Mark Thomson revised this gist Dec 15, 2016. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions import-ftp-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    ### WP All Import - If statement examples

    Here are some example IF statements. The criteria for an IF statment is in XPATH syntax.
    Here are some example IF statements. The criteria for an IF statment is written in XPATH syntax.

    #### Number is equal to:
    `[IF({RetailPrice[.=0]})]**Zero**[ENDIF]`
    `[IF({price[.=0]})]Zero[ENDIF]`

    #### Number is greater than:
    `[IF({RetailPrice[.>0]})]Greater than 0[ENDIF]`
    `[IF({price[.>0]})]Greater than 0[ENDIF]`

    #### Text is equal to:
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`
    @@ -20,5 +20,5 @@ Here are some example IF statements. The criteria for an IF statment is in XPATH
    #### Text length is:
    `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]`

    ### [ELSE] example:
    `[IF({title[text() = '']})]**The title is empty**[ELSE]**{title}**[ENDIF]`
    #### IF/ELSE example:
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
  16. Mark Thomson revised this gist Dec 15, 2016. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions import-ftp-syntax.md
    Original file line number Diff line number Diff line change
    @@ -2,23 +2,23 @@

    Here are some example IF statements. The criteria for an IF statment is in XPATH syntax.

    #### Number is equal to
    `[IF({RetailPrice[.=0]})]Zero[ENDIF]`
    #### Number is equal to:
    `[IF({RetailPrice[.=0]})]**Zero**[ENDIF]`

    #### Number is greater than
    #### Number is greater than:
    `[IF({RetailPrice[.>0]})]Greater than 0[ENDIF]`

    #### Text is equal to
    #### Text is equal to:
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`

    #### Text is empty
    #### Text is empty:
    `[IF({title[text() = '']})]The title is empty[ENDIF]`

    #### Text contains
    #### Text contains:
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`

    #### Text length is
    #### Text length is:
    `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]`

    ### [ELSE] example:
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
    `[IF({title[text() = '']})]**The title is empty**[ELSE]**{title}**[ENDIF]`
  17. Mark Thomson revised this gist Dec 15, 2016. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions import-ftp-syntax.md
    Original file line number Diff line number Diff line change
    @@ -6,19 +6,19 @@ Here are some example IF statements. The criteria for an IF statment is in XPATH
    `[IF({RetailPrice[.=0]})]Zero[ENDIF]`

    #### Number is greater than
    [IF({RetailPrice[.>0]})]Greater than 0[ENDIF]
    `[IF({RetailPrice[.>0]})]Greater than 0[ENDIF]`

    #### Text is equal to
    [IF({title[text() = 'Foo']})]The title is Foo[ENDIF]
    `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]`

    #### Text is empty
    [IF({title[text() = '']})]The title is empty[ENDIF]
    `[IF({title[text() = '']})]The title is empty[ENDIF]`

    #### Text contains
    [IF({title[contains(.,’Foo')]})]Has foo[ENDIF]
    `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]`

    #### Text length is
    [IF({Address[1]/latitude[string-length()>0]})][ENDIF]
    `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]`

    ### [ELSE] example:
    [IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]
    `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]`
  18. Mark Thomson revised this gist Dec 15, 2016. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions import-ftp-syntax.md
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,24 @@
    ### WP All Import - If statement examples

    Here are some example IF statements. This is XPATH syntax. Note you can also have an [ELSE] clause as shown in the last example:
    Here are some example IF statements. The criteria for an IF statment is in XPATH syntax.

    #### Equal to (numeric):
    [IF({RetailPrice[.=0]})]Zero[ENDIF]
    #### Number is equal to
    `[IF({RetailPrice[.=0]})]Zero[ENDIF]`

    #### Greater than (numeric):
    #### Number is greater than
    [IF({RetailPrice[.>0]})]Greater than 0[ENDIF]

    #### Equal to (text):
    #### Text is equal to
    [IF({title[text() = 'Foo']})]The title is Foo[ENDIF]

    #### Empty (text):
    #### Text is empty
    [IF({title[text() = '']})]The title is empty[ENDIF]

    #### Contains (text):
    #### Text contains
    [IF({title[contains(.,’Foo')]})]Has foo[ENDIF]

    #### Length (text):
    #### Text length is
    [IF({Address[1]/latitude[string-length()>0]})][ENDIF]

    #### ELSE example:
    ### [ELSE] example:
    [IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]
  19. Mark Thomson created this gist Dec 15, 2016.
    24 changes: 24 additions & 0 deletions import-ftp-syntax.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    ### WP All Import - If statement examples

    Here are some example IF statements. This is XPATH syntax. Note you can also have an [ELSE] clause as shown in the last example:

    #### Equal to (numeric):
    [IF({RetailPrice[.=0]})]Zero[ENDIF]

    #### Greater than (numeric):
    [IF({RetailPrice[.>0]})]Greater than 0[ENDIF]

    #### Equal to (text):
    [IF({title[text() = 'Foo']})]The title is Foo[ENDIF]

    #### Empty (text):
    [IF({title[text() = '']})]The title is empty[ENDIF]

    #### Contains (text):
    [IF({title[contains(.,’Foo')]})]Has foo[ENDIF]

    #### Length (text):
    [IF({Address[1]/latitude[string-length()>0]})][ENDIF]

    #### ELSE example:
    [IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]