xsl-list
[Top] [All Lists]

Re: [xsl] Adding a border to graphics

2007-10-30 08:11:06
Hi,

Thanks for the response!

Well, I changed the template according to your
suggestions, but now FOP complains:
[Fatal Error] :1:1: Content is not allowed in prolog.
Oct 30, 2007 5:05:01 PM
org.apache.fop.image.analyser.XMLReader createDocument
WARNING: Error while constructing image from XML
org.xml.sax.SAXParseException: Content is not allowed
in prolog.

I use the "diagram_border" template i described
because in the XML files I call the graphics in a
"macro"-like form. For example:

<j_diagram ref="web_filtering_add" t="Add a LAN
Computer"/>

where ref is a file name, and t is a caption.

Best regards,
nancy

--- "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
wrote:

At 2007-10-30 05:34 -0700, Nancy Brandt wrote:
I have encountered the following issue:

I wanna have two kinds of images in my documents:
with a border and without a border.

So I did two things:

1) in my template for bordered images I inserted a
"role" attribute with value "bordered" like that:

Actually, you are missing some concepts in the
specification of 
values of attributes.

<xsl:template match="diagram_border">
<xsl:element name="figure">
    <xsl:attribute name="id">
      <xsl:value-of select="@ref"/>
    </xsl:attribute>
    <xsl:attribute name="role">
    <xsl:value-of select="@bordered"/>
    </xsl:attribute>

You would need <xsl:attribute
name="role">bordered</xsl:attribute>

Or even tighter, I'm not sure why you are using
xsl:element and not just:

    <figure id="{(_at_)ref}" role="bordered">
      ...

    <title>
      <xsl:value-of select="@t"/>
    </title>
    <mediaobject>
      <imageobject>
        <xsl:element name="imagedata">
          <xsl:attribute
name="width">80%</xsl:attribute>
          <xsl:attribute
name="scalefit">1</xsl:attribute>
          <xsl:attribute name="fileref">
          <xsl:value-of select="concat('images/',
@ref,
'.png')"/>
          </xsl:attribute>
        </xsl:element>
      </imageobject>
    </mediaobject>
  </xsl:element>
</xsl:template>


2) I added the following in the customization
layer:

<xsl:template match="imagedata">
<fo:external-graphic>
    <xsl:if
test="ancestor::figure[role|@bordered]">

That test is for the union of a role child or a
bordered attribute, 
not a role attribute with a "bordered" value:

       test="ancestor::figure[(_at_)role='bordered']"

    <xsl:attribute
name="border-color">black</xsl:attribute>
    <xsl:attribute
name="border-style">solid</xsl:attribute>
    </xsl:if>
</fo:external-graphic>
</xsl:template>

However, it does not work. Please, advise!

I hope this helps.

. . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes:
Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL
and UBL training
RSS feeds:     publicly-available developer
resources and training
G. Ken Holman                
mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.         
http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   
+1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07 
http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: 
http://www.CraneSoftwrights.com/legal



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--