docbook-apps

  • 1.  Re: [docbook-apps] Attribute set override.

    Posted 06-28-2011 16:48
    Hi,
    An attribute-set's attributes are evaluated for each instance of it being applied, so you can add xsl:choose to the body of xsl:attribute. You just need to make sure each case returns a valid value so you don't get empty attributes, something like this:

    <xsl:attribute-set name="section.level1.properties">
    <xsl:attribute name="break-before">
    <xsl:choose>
    <xsl:when test="@role = 'nobrk'">auto</xsl:when>
    <xsl:otherwise>page</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    </xsl:attribute-set>

    You cannot have it skip the attribute, but you can change its value to the default "auto"

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: gpevaco@aol.com
    To: docbook-apps@lists.oasis-open.org
    Sent: Thursday, June 23, 2011 10:57 AM
    Subject: [docbook-apps] Attribute set override.




    I have a situation where I have an attribute-set in my fo custom layer.

    <xsl:attribute-set name="section.level1.properties">
    <xsl:attribute name="break-before">page</xsl:attribute>
    </xsl:attribute-set>

    Now the situation is a need to override this behavior in certain instances.
    I have added an attribute to certain sect1 elements, role="nobrk" where I want to override this behavior.

    My question is how do go about setting up the stylesheets to skip or ignore the break-before attribute for the certain elements designated as nobrk.

    I am guessing something like :

    <xsl:template match="sect1[@role='nobrk']">
    <fo:block xsl:use-attribute-sets="section.level1.properties">
    ...

    but am stumped as to how to get it to ignore the break-before override?
    Any suggestions would be most welcome!
    Thanks!
    /Gregorio


  • 2.  Re: [docbook-apps] Attribute set override.

    Posted 06-29-2011 14:55

    Bob:

    Thank you so much for the reply. This is exactly what I was looking for. I never thought to use a choose within an attribute set!
    Now this not only solved my one issue, but has given me a tool that I can use for other issues.

    Thank you!!

    /Gregorio






    -----Original Message-----
    From: Bob Stayton <bobs@sagehill.net>
    To: docbook-apps <docbook-apps@lists.oasis-open.org>; gpevaco <gpevaco@aol.com>
    Sent: Tue, Jun 28, 2011 12:48 pm
    Subject: Re: [docbook-apps] Attribute set override.


    Hi,
    An attribute-set's attributes are evaluated for each instance of it being applied, so you can add xsl:choose to the body of xsl:attribute. You just need to make sure each case returns a valid value so you don't get empty attributes, something like this:


    <xsl:attribute-set name="section.level1.properties">
    <xsl:attribute name="break-before">
    <xsl:choose>
    <xsl:when test="@role = 'nobrk'">auto</xsl:when>
    <xsl:otherwise>page</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    </xsl:attribute-set>

    You cannot have it skip the attribute, but you can change its value to the default "auto"

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net



    ----- Original Message -----
    From: gpevaco@aol.com
    To: docbook-apps@lists.oasis-open.org
    Sent: Thursday, June 23, 2011 10:57 AM
    Subject: [docbook-apps] Attribute set override.





    I have a situation where I have an attribute-set in my fo custom layer.

    <xsl:attribute-set name="section.level1.properties">
    <xsl:attribute name="break-before">page</xsl:attribute>
    </xsl:attribute-set>

    Now the situation is a need to override this behavior in certain instances.
    I have added an attribute to certain sect1 elements, role="nobrk" where I want to override this behavior.

    My question is how do go about setting up the stylesheets to skip or ignore the break-before attribute for the certain elements designated as nobrk.

    I am guessing something like :

    <xsl:template match="sect1[@role='nobrk']">
    <fo:block xsl:use-attribute-sets="section.level1.properties">
    ...

    but am stumped as to how to get it to ignore the break-before override?
    Any suggestions would be most welcome!
    Thanks!
    /Gregorio