日期:2014-05-16 浏览次数:20750 次
<var-def name="trlist"> <xpath expression="//table[@background='../images/dotline.gif'][1]/tbody/*[1]/following-sibling::*"> //xpath的语法要稍微看一下才行 <html-to-xml> <http url="${targetUrl}"/> </html-to-xml> </xpath> </var-def>
<file action="write" path="test_ctsgz_${surf_name}.xml"> <template> <![CDATA[ <root> ]]> </template> <loop item="item" index="i"> <list> <var name="trlist"/> </list> <body> <xquery> <xq-param name="item"> <var name="item"/> </xq-param> <xq-expression><![CDATA[ declare variable $item as node() external; let $order := data($item//td[1]) let $pathName := data($item//td[2]) let $startDate := data($item//td[3]) let $days := data($item//td[4]) let $travelTools := data($item//td[5]) let $price := data($item//td[6]) return <city> <order>{data($order)}</order> <pathName>{data($pathName)}</pathName> <startDate>{data($startDate)}</startDate> <days>{data($days)}</days> <travelTools>{data($travelTools)}</travelTools> <price>{data($price)}</price> </city> ]]></xq-expression> </xquery> </body> </loop> <![CDATA[ </root> ]]> </file>