<?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>1897</bug_id>
          
          <creation_ts>2005-08-26 18:32:17 +0000</creation_ts>
          <short_desc>[XSLT2.0] cardinalities of unparsed-text-available function</short_desc>
          <delta_ts>2005-09-28 14:17:52 +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>XSLT 2.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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="Colin Adams">colin</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <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>5548</commentid>
    <comment_count>0</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2005-08-26 18:32:17 +0000</bug_when>
    <thetext>Both of the arguments to this function have a cardinality of exactly one, whereas 
the corresponding arguments to unparsed-text are optional.
This means you cannot reliably pass a computed value to unparsed-text-available,
as a processor might deduce during the static analysis phase that the only
possible value is the empty sequence, and accordingly raise a type error.
Since unparsed-text would succeed if the first argument is an empty sequence,
then unparsed-text-available should return true given the same value.
For the encoding, if this is the empty sequence, then I am unclear as to what
the processor should do - it does not seem to be specified - I&apos;m personally
treating it the same as if only one argument is present, but I think that
legalistically the current spec. requires the processor to raise XTDE1190.
In any case, unparsed-text-available should not suffer a type error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6316</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2005-09-16 11:08:29 +0000</bug_when>
    <thetext>The Working Group discussed this and agreed it ought to be fixed, and asked the
editor to propose the detailed revision. Subject to confirmation by the WG, I
propose the following.

(a) to align with doc-available(), the first argument of
unparsed-text-available() will accept an empty sequence, and will return false
in this case.

(b) we normally adopt a principle that where a value is optional, then it ought
to be possible to specify an explicit value whose effect is equivalent to
defaulting it. Applying this principle, I propose that if the second argumnent
of unparsed-text-available() is an empty sequence, the effect should be the same
as calling the one-argument version of the function. [There are
counter-examples. We don&apos;t allow an empty sequence as the third argument of
substring(), for example. However, it&apos;s not a big issue either way, and this
seems a reasonable approach.]

Michael Kay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6317</commentid>
    <comment_count>2</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2005-09-16 11:19:18 +0000</bug_when>
    <thetext>Your proposed alignment with doc-available (empty sequence returns false()),
will only be a true alignment if the wording for unparsed-text-available is
change to read:

&quot;The unparsed-text-available function determines whether a call on the
unparsed-text function with identical arguments would return a non-empty string&quot;

(then it aligns with returning a document-node).
But an empty string could be a sucessful fetch of a file - a zero-length text
file, so i still think it should return true().

And after all, what is the point of the function? Surely, it is to avoid raising
an error, so it should only return false() if an error would have occured.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6318</commentid>
    <comment_count>3</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2005-09-16 11:27:05 +0000</bug_when>
    <thetext>Oops! It DOESN&apos;T return a string in that case.
So false() is appropriate, and I suggest wording of:

&quot;The unparsed-text-available function determines whether a call on the
unparsed-text function with identical arguments would return a non-empty sequence&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6320</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2005-09-16 11:53:20 +0000</bug_when>
    <thetext>I can see your point. But I don&apos;t see where you get &quot;non-empty string&quot; from. We
should change it from:

The unparsed-text-available function determines whether a call on the
unparsed-text function with identical arguments would succeed.

to

The unparsed-text-available function determines whether a call on the
unparsed-text function with identical arguments would return a string.

which is an exact analogy of doc-available(), which says:

If fn:doc($uri) returns a document node, this function returns true

Michael Kay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6535</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2005-09-28 14:17:39 +0000</bug_when>
    <thetext>The XSL WG agreed with my amended proposal, which now is in three parts:

(a) to align with doc-available(), the first argument of
unparsed-text-available() will accept an empty sequence, and will return false
in this case.

(b) we normally adopt a principle that where a value is optional, then it ought
to be possible to specify an explicit value whose effect is equivalent to
defaulting it. Applying this principle, I propose that if the second argumnent
of unparsed-text-available() is an empty sequence, the effect should be the same
as calling the one-argument version of the function. [There are
counter-examples. We don&apos;t allow an empty sequence as the third argument of
substring(), for example. However, it&apos;s not a big issue either way, and this
seems a reasonable approach.]

(c) change the summary of the function to read:

The unparsed-text-available function determines whether a call on the
unparsed-text function with identical arguments would return a string.

We are therefore marking the issue as FIXED/CLOSED. If you have any problems
with this resolution, please reopen the bug.

Michael Kay
for the XSL Working Group</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>