[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] Adding new element to docbook DTD
John Dyer wrote: > While this would work, my writers have expressed that they want their > conditions to be listed under a single attribute. Technically, I think > this is one of two correct ways to approach this (see below). Also, at > this point we have six products that will be profiled, and that number > is expected to grow. I don't think that it is good idea to place unrelated conditions into a single attribute. But if you want to do it, you can, but you must create your customized version of the following template: <!-- Returns non-empty string if list in $b contains one ore more values from list $a --> <xsl:template name="cross.compare"> <xsl:param name="a"/> <xsl:param name="b"/> <xsl:param name="sep" select="$profile.separator"/> <xsl:variable name="head" select="substring-before(concat($a, $sep), $sep)"/> <xsl:variable name="tail" select="substring-after($a, $sep)"/> <xsl:if test="contains(concat($sep, $b, $sep), concat($sep, $head, $sep))">1</xsl:if> <xsl:if test="$tail"> <xsl:call-template name="cross.compare"> <xsl:with-param name="a" select="$tail"/> <xsl:with-param name="b" select="$b"/> </xsl:call-template> </xsl:if> </xsl:template> Your version of template should return non-empty string only if $b contains all conditions mentioned in $a. > Another approach that I thought would work would be to define custom > profiling attributes that can be set to "true" or "false". I think this > would actually be a better solution than my original idea of adding the > <if> element. But it seems that this will not work either. It appears > that docbook only allows creation of a single custom attribute through > the profile.attribute parameter. Is there any way to use more than one > custom attribute? Are you sure, that your conditions can not be stored in attributes like os, wordsize, arch, ... which are supported directly? Even if not, you can customize template <xsl:template match="*" mode="profile"> from profiling/profile-mode.xsl to handle your custom attributes. > I really appreciate all the responses. I would be very interested in > any feedback on the possible approach of adding more custom attributes > (mentioned in my reply to Jirka) or any other ideas you might have. I > really think that is the best possible solution. > > I get the feeling from the responses I am getting that customizing the > DTD is not something that is reccommended. Is this the case? Why? I think that opposite is true. With customized DTD efficiency of authoring and your whole documentation system will be much better than with stock DocBook. (Of course, I'm biased here, because it is my job to create custom DocBook based documentation systems for my customers. :-) Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz ------------------------------------------------------------------ Profesionální školení a poradenství v oblasti technologií XML. Podívejte se na náš nově spuštěný web http://DocBook.cz Podrobný přehled školení http://xmlguru.cz/skoleni/ ------------------------------------------------------------------ Nejbližší termíny školení: ** XSLT 13.-16.3.2006 ** XML schémata 24.-26.4.2006 ** ** DocBook 15.-17.5.2006 ** XSL-FO 12.-13.6.2006 ** ------------------------------------------------------------------ http://xmlguru.cz Blog mostly about XML for English readers ------------------------------------------------------------------
S/MIME Cryptographic Signature
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]