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]

XSLT 'or' statement (Was Re: How can I get stylesheet tobold?)


Bob,

Since I thought your use of the 'or' functionality was quite cool, I
modified my customization layer along the lines of what you did:

> <xsl:template match="emphasis">
>   <xsl:choose>
>     <xsl:when test="@role='bold'|@role='strong'">  <!-- changed line -->
>       <xsl:call-template name="inline.boldseq"/>
>     </xsl:when>
>     <xsl:otherwise>
>       <xsl:call-template name="inline.italicseq"/>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>

However, in running it through 'xsltproc' I found that I was getting
an error generated. It actually seemed to work correctly, but gave me
error messages.  I did some research and found that the 'or' functionality
of XSLT actually uses the word "or".  So the test needs to be:

   <xsl:when test="(@role='strong') or (@role='bold')">

Once I changed that, everything worked fine and no errors were
produced.  One source for this is on the XPath page at:

  http://www.w3.org/TR/xpath#booleans

I was a bit surprised as I expected the "|" symbol to work, but it 
appears that it is at least not "proper" XSLT.  (At least that is
what I could see in the docs.)

Regards,
Dan

-- 
Dan York, Director of Training        dyork@e-smith.com
Ph: +1-613-751-4401  Mobile: +1-613-263-4312 Fax: +1-613-564-7739 
e-smith, inc. 150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada
http://www.e-smith.com/            open source, open mind

------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org


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