-
-
Save dungtd91/b6150f4e261d52ccf55221598c3cc674 to your computer and use it in GitHub Desktop.
Revisions
-
m-thomson revised this gist
Oct 12, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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/). Note: The `[ELSE]<something>` part is optional #### Number is equal to: -
m-thomson revised this gist
Sep 16, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ ## 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[ELSE]Not Zero[ENDIF]` #### Number is greater than: `[IF({price[.>0]})]Greater than 0[ENDIF]` -
m-thomson revised this gist
Aug 6, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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]` #### Number is greater than: `[IF({price[.>0]})]Greater than 0[ENDIF]` #### Text is equal to: `[IF({title[.='Foo']})]The title is Foo[ENDIF]` #### Text is not equal to: `[IF({title[.!='Foo']})]The title is not Foo[ENDIF]` #### Text is empty (see note below): `[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]` **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. -
m-thomson revised this gist
Aug 6, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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]` #### Number is greater than: `[IF({price[. >0]})]Greater than 0[ENDIF]` #### Text is equal to: `[IF({title[. ='Foo']})]The title is Foo[ENDIF]` #### Text is not equal to: `[IF({title[. !='Foo']})]The title is not Foo[ENDIF]` #### Text is empty (see note below): `[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]` **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. -
m-thomson revised this gist
Aug 6, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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[.='Foo']})]The title is Foo[ENDIF]` #### Text is not equal to: `[IF({title[.!='Foo']})]The title is not Foo[ENDIF]` #### Text is empty (see note below): `[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]` **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. -
m-thomson revised this gist
Jul 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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/). #### Number is equal to: -
m-thomson revised this gist
Jul 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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/) #### Number is equal to: -
m-thomson revised this gist
Jul 25, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ ## 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/ #### Number is equal to: `[IF({price[.=0]})]Zero[ENDIF]` -
m-thomson revised this gist
Jun 30, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 not Foo[ENDIF]` #### Text is empty (see note below): `[IF({title[text() = '']})]The title is empty[ENDIF]` -
m-thomson revised this gist
Jun 30, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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]` -
m-thomson revised this gist
Jun 15, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 (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]` **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. -
m-thomson revised this gist
Apr 8, 2017 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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/). #### Number is equal to: `[IF({price[.=0]})]Zero[ENDIF]` -
m-thomson revised this gist
Apr 8, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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](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({title[string-length()>10]})]{title}[ENDIF]` #### IF/ELSE example: `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]` -
Mark Thomson renamed this gist
Dec 15, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## WP All Import - If statement examples 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]` -
Mark Thomson revised this gist
Dec 15, 2016 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 written in XPATH syntax. #### Number is equal to: `[IF({price[.=0]})]Zero[ENDIF]` #### Number is greater than: `[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]` #### IF/ELSE example: `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]` -
Mark Thomson revised this gist
Dec 15, 2016 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 greater than: `[IF({RetailPrice[.>0]})]Greater than 0[ENDIF]` #### Text is equal to: `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]` #### Text is empty: `[IF({title[text() = '']})]The title is empty[ENDIF]` #### Text contains: `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]` #### Text length is: `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]` ### [ELSE] example: `[IF({title[text() = '']})]**The title is empty**[ELSE]**{title}**[ENDIF]` -
Mark Thomson revised this gist
Dec 15, 2016 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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]` #### Text is equal to `[IF({title[text() = 'Foo']})]The title is Foo[ENDIF]` #### Text is empty `[IF({title[text() = '']})]The title is empty[ENDIF]` #### Text contains `[IF({title[contains(.,’Foo')]})]Has foo[ENDIF]` #### Text length is `[IF({Address[1]/latitude[string-length()>0]})][ENDIF]` ### [ELSE] example: `[IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF]` -
Mark Thomson revised this gist
Dec 15, 2016 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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. The criteria for an IF statment is in XPATH syntax. #### Number is equal to `[IF({RetailPrice[.=0]})]Zero[ENDIF]` #### Number is greater than [IF({RetailPrice[.>0]})]Greater than 0[ENDIF] #### Text is equal to [IF({title[text() = 'Foo']})]The title is Foo[ENDIF] #### Text is empty [IF({title[text() = '']})]The title is empty[ENDIF] #### Text contains [IF({title[contains(.,’Foo')]})]Has foo[ENDIF] #### Text length is [IF({Address[1]/latitude[string-length()>0]})][ENDIF] ### [ELSE] example: [IF({title[text() = '']})]The title is empty[ELSE]{title}[ENDIF] -
Mark Thomson created this gist
Dec 15, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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]