subject:ตัวอย่างการใช้ for in
<?xml version="1.0" encoding="window-874" ?>
<?xml-stylesheet type="text/xsl" href="filename.xsl" ?>
<internet>
<website id="1">
<domain>
<protocol>http</protocol>
<name>function</name>
<extension>in.th</extension>
</domain>
<logo width="80px" />
<register>10 January 2553</register>
<country>Thailand</country>
</website>
<website id="2">
<domain>
<protocol>http</protocol>
<name>catalogtoday</name>
<extension>com</extension>
</domain>
<logo width="80px" />
<register>14 Febuary 2553</register>
<country>Thailand</country>
</website>
</internet>
example:for $value in doc("filename.xml")//website
where contains($value/domain/extension/text(), "in")
return <website name="{string($value/domain/name)}">
{
for $subValue in $value
where ! contains($value/domain/extension/text(), "in")
return $subValue/domain/protocol/text()
}
</website>