The syntax that David provided works great -- Thank you!

I have a further question regarding the delimiter. What is the default 
delimiter for attributes? In reading 
http://www.sagehill.net/docbookxsl/ProfilingWithRole.html, I think
that the delimiter is supposed to be a semi-colon. However, the only 
delimiter that seems to work in my XML is a space. Where is the delimiter 
set in the RNG schema?

This is the error that I keep getting when I try to set multiple attribute 
values: <sidebar vendor="Blackberry;Kate;Linux">
E [Jing] value of attribute "vendor" is invalid; token 
"Blackberry;Kate;Linux" invalid; must be equal to "Blackberry", "Kate", 
"Linux", "Mac" or "iOS"

Thanks again,
Kate

..........................................................................................................................................................................................................................
 

Kate Wringe | Senior Information Developer | SQL Anywhere Doc Team |
Sybase | 445 Wes Graham Way, Waterloo, ON, N2L 6R2 Canada | Tel: (519) 
883-6838 | [email protected] | www.sybase.com



"Cramer, David W (David)" <[email protected]> 
02/03/2011 12:57 PM

To
"[email protected]" <[email protected]>
cc
"[email protected]" <[email protected]>, "[email protected]" 
<[email protected]>, "[email protected]" 
<[email protected]>
Subject
RE: [docbook] More than one value for an attribute.






Someone offlist pointed out a syntax error in my example. You?ll also need 
a <choice> in there to make it work. And indeed, as Bob points out, if you 
use space as a delimiter, none of your values can have spaces:
 
                                <define name="db.vendor.attribute"> 
                                                <attribute name="vendor"> 
                                                                
<a:documentation>Indicates?</a:documentation> 
                                                                <list> 
                                                                                
<oneOrMore>
                                                                                
                
<choice>
                                                                                
                                
<value>Windows</value> 
                                                                                
                                
<value>Linux</value> 
                                                                                
                                
<value>Mac</value> 
                                                                                
                                
<value>iOS</value> 
                                                                                
                                
<value>Blackberry</value> 
                                                                                
                
</choice>
                                                                                
</oneOrMore>                                                                 

                                                                </list> 
                                                </attribute> 
                                </define>
 
David
 
From: Cramer, David W (David) [mailto:[email protected]] 
Sent: Thursday, February 03, 2011 10:55 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [docbook] More than one value for an attribute.
 
Hi Kate,
I know that RelaxNG has a ?list? pattern: 
http://www.relaxng.org/tutorial-20011203.html#IDAK0YR
 
What I don?t know is if you can specify the delimiter. Maybe a RelaxNG 
expert out there can help us.
 
I believe you can set the profiling delimiter in the xslts, so you could 
set that to space and then do something like the following:
 
<define name="db.vendor.attribute"> 
  <attribute name="vendor"> 
  <a:documentation>Indicates?</a:documentation> 
   <list> 
   <oneOrMore>
       <value type="token">Windows</value> 
       <value type="token">Linux</value> 
       <value type="token">Mac</value> 
       <value type="token">iOS</value> 
       <value type="token">Blackberry</value> 
   </oneOrMore>
 </list> 
   </attribute> 
 </define>
 
That takes care of the validation side, but I don?t know if your editor 
(Oxygen I assume) will automatically help the user add valid values. 
 
David
 
 
From: [email protected] [mailto:[email protected]] 
Sent: Thursday, February 03, 2011 9:58 AM
To: Cramer, David W (David)
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [docbook] More than one value for an attribute.
 

Thank you to all who responded to my query. 

David's example with xrefstyle is close to what I want to be able to do. I 
define the vendor attribute as follows 

 <define name="db.vendor.attribute"> 
  <attribute name="vendor"> 
  <a:documentation>Indicates the level of user experience for which the 
element applies</a:documentation> 
   <choice> 
       <value type="token">Windows</value> 
       <value type="token">Linux</value> 
       <value type="token">Mac</value> 
       <value type="token">iOS</value> 
       <value type="token">Blackberry</value> 
 </choice> 
   </attribute> 
 </define> 

Then in my XML file, I set the vendor attribute to two values (separating 
them with a semi-colon) 
<section xmlns="http://docbook.org/ns/docbook"; version="5.0" 
xml:id="da-dboptions" remap="concept" vendor="Blackberry;Mac"> 

But, I keep getting the following error in my authoring tool (I'm using 
oXygen) 

SystemID: C:\src\db\pubs\dbAdmin\da-dboptions2.xml 
Engine name: Jing 
Severity: error 
Description: value of attribute "vendor" is invalid; must be equal to 
"Windows", "Linux", "Mac", "iOs" or "Blackberry" 
Start location: 13:23 
End location: 13:34

Is there something that I need to set in the RNG file so that it knows 
that the vendor attribute can have more than one value? 

Thanks, 
Kate 

..........................................................................................................................................................................................................................
 

Kate Wringe | Senior Information Developer | SQL Anywhere Doc Team |
Sybase | 445 Wes Graham Way, Waterloo, ON, N2L 6R2 Canada | Tel: (519) 
883-6838 | [email protected] | www.sybase.com 

"Cramer, David W (David)" <[email protected]> 
02/02/2011 11:06 AM 


To
"[email protected]" <[email protected]>, "[email protected]" 
<[email protected]>, "[email protected]" 
<[email protected]>, "[email protected]" 
<[email protected]> 
cc

Subject
RE: [docbook] More than one value for an attribute.
 








Ah, perfect for my case and so simple. All I have to do (using RelaxNG and 
Oxygen) is: 
  
                                <define name="db.xrefstyle.attribute"> 
                                                <attribute 
name="xrefstyle"> 
 <a:documentation>Specifies a keyword or keywords identifying additional 
style information</a:documentation> 
                                                                <choice> 
      <value type="token">select: nopage</value> 
      <value type="token">select: label nopage</value> 
      <value type="token">select: linktext</value> 
      <text/> 
                                                                </choice> 
                                                </attribute> 
                                </define> 
  
Not sure about Kate?s case :-) 
  
Thanks, 
David 
  
From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, February 02, 2011 9:17 AM
To: Cramer, David W (David); [email protected]; 
[email protected]; [email protected]
Subject: RE: [docbook] More than one value for an attribute. 
  
As you say, I think it is editor customization, and that depends on the 
editor. 
  
In Arbortext Editor, you can get what amounts to a combobox, with free 
form text entry in addition to a list of common choices. You do this by 
defining an attribute value space to be the union of an enumeration (list 
of specific items) and a text pattern that defines exactly what you can 
type. For example: 
  
            <xs:simpleType name="vendor"> 
                        <xs:union> 
                                    <!-- TYPICAL VALUES TO CHOOSE FROM --> 

                                    <xs:simpleType> 
                                                <xs:restriction 
base="xs:string"> 
 <xs:enumeration value="linux" /> 
 <xs:enumeration value="mac" /> 
 <xs:enumeration value="windows" /> 
                                                </xs:restriction> 
                                    </xs:simpleType> 
                                    <!-- STRING PATTERN IF TYPED MANUALLY 
--> 
                                    <xs:simpleType> 
                                                <xs:restriction 
base="xs:string"> 
                                                            <xs:pattern 
value="(linux|mac|windows)((;(linux|mac|windows))*)?" /> 
                                                </xs:restriction> 
                                    </xs:simpleType> 
                        </xs:union> 
            </xs:simpleType> 
  
I don't know if other editors would handle this in a similar way. 
  
  
  
From: Cramer, David W (David) [mailto:[email protected]] 
Sent: Wednesday, February 02, 2011 4:58 AM
To: Bob Stayton; [email protected]; [email protected]
Subject: RE: [docbook] More than one value for an attribute. 
  
As soon as I hit send, I woke up a little and realized that what you 
really want is a dialog box in the editor (launched by a button or 
whatever) that lets the writer click one or more checkboxes for each 
value, then when they click ok, it turns the selected values into a comma 
delimited list as the attribute value. For my xrefstyle case, I?d use 
radio buttons instead of check boxes. The user is still free to edit the 
attribute value manually.  You could also customize the xslts to check the 
list of values to make sure nothing unsupported was entered. 
  
David 
  
From: Cramer, David W (David) [mailto:[email protected]] 
Sent: Wednesday, February 02, 2011 6:43 AM
To: Bob Stayton; [email protected]; [email protected]
Subject: RE: [docbook] More than one value for an attribute. 
  
Hi Kate, 
As Bob says, the DocBook xsl?s profiling mechanism supports this, but I 
take your question to be about the authoring side of the problem. What you 
really want to know is if there?s a way to help the writer avoid doing 
something like vendor=?Windows XP, Linix? (where ?Linix? is misspelled and 
so won?t have the desired effect). That seems to me a matter of editor 
customization. In fact, this is on my list of things to look into wrt the 
xrefstyle attribute. In that case, I would like to offer the writer a list 
of typical choices but still leave them free to enter arbitrary text so I 
don? t have to enumerate every possibility in the schema. I haven?t 
figured out what to do yet, so please let me know if you come up with a 
situation. You might also ask your editor?s support folks to see if they 
have suggestions. 
  
David 
  
From: Bob Stayton [mailto:[email protected]] 
Sent: Tuesday, February 01, 2011 6:02 PM
To: [email protected]; [email protected]
Subject: Re: [docbook] More than one value for an attribute. 
  
Yes, you can do this.  See the third bullet item in this reference: 
  
http://www.sagehill.net/docbookxsl/MultiProfile.html 
  
Bob Stayton
Sagehill Enterprises
[email protected] 
 
  
----- Original Message ----- 
From: [email protected] 
To: [email protected] 
Sent: Tuesday, February 01, 2011 3:43 PM 
Subject: [docbook] More than one value for an attribute. 
  

Hello, 

Is there a way to define an attribute so that the writer can select more 
than one choice for its value (i.e., can an attribute be set to a 
delimited list of values)? 

For example: vendor= "Windows XP, Windows 2008, Linux, Unix, Mac, iOS". 

It seems that when attributes are discussed, that there is an assumption 
that the writer only wants to pick one value for the attribute. For 
example, when setting 
the vendor attribute, the writer only needs to choose between Windows or 
Linux. However, we need to be able to specify more than value for the 
vendor attribute. 
For example some of our content applies to Windows only, some of the 
content applies to Windows and Linux, some of the content applies to iOs 
and Mac Os, some of the content 
applies to Windows, Linux, and Mac Os, etc., As we support more operating 
systems, the number of vendor combinations increases. We need to be able 
to append the new OS to the 
vendor attribute. We don't want to have a set of different combinations to 
choose from as this would be cumbersome to work with. 

Any thoughts or suggestions would be greatly appreciated. 

Thank you,
Kate 


..........................................................................................................................................................................................................................
 

Kate Wringe | Senior Information Developer | SQL Anywhere Doc Team |
Sybase | 445 Wes Graham Way, Waterloo, ON, N2L 6R2 Canada | Tel: (519) 
883-6838 | [email protected] | www.sybase.com 

Reply via email to