This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3008 - Error in example 18
Summary: Error in example 18
Status: CLOSED FIXED
Alias: None
Product: ITS
Classification: Unclassified
Component: ITS techniques (show other bugs)
Version: WorkingDraft
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Felix Sasaki
QA Contact: Felix Sasaki
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-15 21:49 UTC by Jirka Kosek
Modified: 2006-07-24 10:25 UTC (History)
0 users

See Also:


Attachments

Description Jirka Kosek 2006-03-15 21:49:23 UTC
Error in example 18.

 <its:documentRule its:translateSelector="//*[@dita:translate='yes']" 
        its:translate="yes"/>
      <its:documentRule its:translateSelector="//*[@dita:translate='no']" 
        its:translate="no"/>

Attribute translate is not in dita namespace and should not be prefixed in XPath expressions above.
Comment 1 Felix Sasaki 2006-03-27 06:19:56 UTC
(In reply to comment #0)
> Error in example 18.
> 
>  <its:documentRule its:translateSelector="//*[@dita:translate='yes']" 
>         its:translate="yes"/>
>       <its:documentRule its:translateSelector="//*[@dita:translate='no']" 
>         its:translate="no"/>
> 
> Attribute translate is not in dita namespace and should not be prefixed in
> XPath expressions above.
> 
Hi Jirka,

The attribute *is* in the DITA namespace. The default namespace of the document is the DITA namespace. However, only inside the <documentRules> element we use a prefix, via a schematron like namespace binding mechanism.
Comment 2 Jirka Kosek 2006-03-27 06:43:35 UTC
But default namespace is not applied to attributes, only to elements. See http://www.w3.org/TR/REC-xml-names/#defaulting 
Comment 3 Felix Sasaki 2006-03-27 07:00:11 UTC
(In reply to comment #2)
> But default namespace is not applied to attributes, only to elements. See
> http://www.w3.org/TR/REC-xml-names/#defaulting 
> 
As I said, we are using a separate namespace binding mechanism, like schematron. IMO, we need to have attribute values with prefixes too. How would you otherwise describe the difference between
 <its:documentRule its:translateSelector="//*[@dita:translate='yes']" 
        its:translate="yes"/>
and
 <its:documentRule its:translateSelector="//*[@xyz:translate='yes']" 
        its:translate="yes"/>
I am assuming that both the vocabularies "dita" and "xyz" have a translate attribute.
Comment 4 Jirka Kosek 2006-03-27 07:15:46 UTC
You are missing my point. Try to evaluate

//*[@dita:translate='yes']

over sample DITA instance you have in spec. You will see, that nothing is returned. If you need to target only DITA elements with translate attribute, use

//dita:*[@translate='yes']
Comment 5 Felix Sasaki 2006-03-27 07:23:24 UTC
(In reply to comment #4)
> You are missing my point. Try to evaluate
> 
> //*[@dita:translate='yes']
> 
> over sample DITA instance you have in spec. You will see, that nothing is
> returned. If you need to target only DITA elements with translate attribute,
> use
> 
> //dita:*[@translate='yes']
> 

How would you write an XPath expression (using the ITS namespace binding mechanism) that gives you all DITA elements, with a translate attribute with the value "yes" from a namespace XYZ? Would that be
//dita:*[@xyz:translate='yes']?
Comment 6 Jirka Kosek 2006-03-27 07:29:28 UTC
Yes
Comment 7 Felix Sasaki 2006-03-27 07:34:00 UTC
(In reply to comment #6)
> Yes
> 

Then: How would you write an XPath expression (using the ITS namespace binding
mechanism) that gives you all elements (from any namespace), with a translate attribute with the value "yes" from a namespace XYZ?
Comment 8 Jirka Kosek 2006-03-27 07:38:02 UTC
//*[@xyz:translate = 'yes']

Please note that the following two documents are *not* same:

<x:a xmlns:x="foo">
  <x:b x:c="bar"/>
</x:a>

<a xmlns="foo">
  <b c="bar"/>
</a>

In the first sample attribute "c" is in "foo" namespace (via "x" prefix). In the second example attribute "c" is in no namespace.
Comment 9 Felix Sasaki 2006-03-27 07:56:41 UTC
(In reply to comment #8)
> //*[@xyz:translate = 'yes']
> 
> Please note that the following two documents are *not* same:
> 
> <x:a xmlns:x="foo">
>   <x:b x:c="bar"/>
> </x:a>
> 
> <a xmlns="foo">
>   <b c="bar"/>
> </a>
> 
> In the first sample attribute "c" is in "foo" namespace (via "x" prefix). In
> the second example attribute "c" is in no namespace.
> 

O.K., so the error is not in the XPath expression but in the instance, which should say

<ph its:translate="no" xml:lang="fr">Et voilĂ  !</ph> The last rule wins

whereas the XPath expression in the documentRule still will be

//*[@dita:translate='no']

Note that we reserve in our description of namespace binding in documentRule(s) names without a prefix for the "no namespace" case.
Comment 10 Jirka Kosek 2006-03-27 14:20:51 UTC
No, sample document is OK, because DITA has its own translate attribute. The problem is in XPath expression, which should be either:

//*[@translate='yes']

or

//dita:*[@translate='yes']

depending whether you are expecting foreign elements in DITA instances.

Comment 11 Yves Savourel 2006-04-07 19:34:56 UTC
Resolve

(This is Example 15 in current draft
Titled "Mapping of the ITS data categories translatability and terminology to [Dita 1.0] markup")

Comment 12 Felix Sasaki 2006-07-24 10:25:58 UTC
Closed, no further action necessary.