This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DocBook XML / XSL Problems (attribute tests seem alwaystrue)


Hello,

I have spent several hourse on the problem I posted before and have 
found out that:

I am not getting chapter, section, figure numbers because the test
for @label will be true even if I have no label attribute in the tag.

Example:

a) the xml fragment:
<figure><title>My Sample Figure</title>
<graphic fileref="sample.jpg"/>
</figure>

b) the matching template that will generate the label (fragment)

I have modified this to tell me whether a @label was found which
will override the automatically generated id.

Running it against above xml file (saxon 6.4.2, docbook xml 4.1.2)
will output 'Label found:'

   <xsl:choose>
     <xsl:when test="@label">
     <xsl:message>
         Label found:
         <xsl:value-of select="@label"/></xsl:message>
       <xsl:value-of select="@label"/>
     </xsl:when>
     <xsl:otherwise>
	 <!-- Generate the label automatically -->
     </xsl:otherwise>
   </xsl:choose>

c) working template:

When I modify the line that tests for @label to read

     <xsl:when test="@label and not(string-length(@label)=0)">

everything works fine.


The same problem occurs in several other cases (e.g. an existing but
empty @scale in graphic will render as an image with a width of "%" in
HTML :-(

I understand that the modification of the templates is merely a way to 
pinpoint my problem, not the solution. I have however no idea what the 
solution might look like.

If anyone else has this problem and a solution along with it, please 
drop me a line.

Cheers,
Ben


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]