<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>6288</bug_id>
          
          <creation_ts>2008-12-08 21:26:29 +0000</creation_ts>
          <short_desc>[UPDUseCase] Static Typing and Parts Q3 Solution 2</short_desc>
          <delta_ts>2009-02-17 16:08:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Update Facility 1.0 Use Cases</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Eisenberg">andrew.eisenberg</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>Tom.Brosens</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>22710</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2008-12-08 21:26:29 +0000</bug_when>
    <thetext>The query in Parts Q3 Solution 2 is:

declare updating function 
    local:delete-subtree($p as element(part))
  {
      for $child in doc(&quot;part-list.xml&quot;)//part
      where $p/@partid eq $child/@partof
      return (
        delete nodes $child,
        local:delete-subtree($child)
      )
  };

for $p in doc(&quot;part-list.xml&quot;)//part[@name=&quot;car&quot;]
return 
  local:delete-subtree($p)


In Bug #5826, Tom Brosens points out that the type of $p in the function declaration should be changed to element(part, xs:untyped).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23620</commentid>
    <comment_count>1</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2009-02-10 13:09:30 +0000</bug_when>
    <thetext>I am fixing this by adding a note to the example:


Solution 2 (using a recursive updating function):

declare updating function 
    local:delete-subtree($p as element(part))
  {
      for $child in doc(&quot;part-list.xml&quot;)//part
      where $p/@partid eq $child/@partof
      return (
        delete nodes $child,
        local:delete-subtree($child)
      )
  };

for $p in doc(&quot;part-list.xml&quot;)//part[@name=&quot;car&quot;]
return 
  local:delete-subtree($p)


NOTE:

Because this data is not covered by a schema, an implementation that supports static typing will raise an error for the comparison $p/@partid eq $child/@partof. This can be solved by creating a schema for the data and importing it into the query.



Please let me know if this is not sufficient.

Jonathan
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>