A few months late but here is my solution I had found...
Given a table ("numberList" in this fake example).
I then removed all of the <tr> and </tr> with regex replaces.
Then used Xquery to pull the data I needed. See below.
<config><var-defname="page_num"overwrite="false">0</var-def><var-defname="number"><xpathexpression="//table[@class='numberList']/tbody"><html-to-xml><httpurl="http://www.number.com/number-list.php?page=${page_num}"/></html-to-xml></xpath></var-def><var-defname="tr_begin_replace"><regexpreplace="true"><regexp-pattern><![CDATA[<tr>\s*\n]]></regexp-pattern><regexp-source><varname="tr_slash_replace"/></regexp-source><regexp-result><template></template></regexp-result></regexp></var-def><var-defname="tr_end_replace"><regexpreplace="true"><regexp-pattern><![CDATA[</tr>\s*\n*]]></regexp-pattern><regexp-source><varname="tr_begin_replace"/></regexp-source><regexp-result><template></template></regexp-result></regexp></var-def><var-defname="Final"><xquery><xq-paramname="doc"><varname="tr_end_replace"></var></xq-param><xq-expression><![CDATA[ declare variable $doc as node()* external; for $td in $doc//tbody/td let $name := $td//a let $number := $td//div return <numbers><name>{normalize-space(data($name))}</name><number>{normalize-space(data($number))}</number> </numbers> ]]></xq-expression></xquery></var-def><fileaction="write"path="NumbersFinal_${page_num}.xml"><varname="Final"></var></file></config>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have successfully filtered down my html file to an xml
that looks like so (only showing one record):
Here's my code:
This correctly pulls what I need :
BUT, when I have any more than one , I get an xQuery error.
It does not like multiple columns.
Does anyone see any reason why?
Thanks.
Last edit: Queezy 2013-02-13
I figured out my issue. I will post my resolution soon.
A few months late but here is my solution I had found...
Given a table ("numberList" in this fake example).
I then removed all of the <tr> and </tr> with regex replaces.
Then used Xquery to pull the data I needed. See below.