Loading ...
Sorry, an error occurred while loading the content.

Re: Assign Attributes to Figure Images in PDF Output

Expand Messages
  • msjensen8486
    Thanks Sev, that code definitely improved how the .pdf rendered the fo. Unfortunately the align attribute isn t allowed at , , or
    Message 1 of 9 , Jun 28, 2013
    • 0 Attachment
      Thanks Sev, that code definitely improved how the .pdf rendered the fo. Unfortunately the align attribute isn't allowed at <fo:flow>, <fo:block>, or <fo:external-graphic> nodes. However I was able to restrict the attribute sets and added the align attribute to the image attribute set and generate the .pdf without error, but I'm not receiving results. I still need to add the attributes to the <image> tag in the source .xml to get the results I want.

      I notice in the common.xsl/images.xsl that the imageAlign param is being set to @align. Does that shut off the attribute set in the output?

      All these questions for you. It's just like being back at the office again. ;-)

      --Mark


      --- In dita-users@yahoogroups.com, Severin Foreman <severin.foreman@...> wrote:
      >
      > Right on. Keep in mind that some of the information below, like the location of the XSL override file, is specific to how I set up PDF customizations at Epicor in version 1.5.1 of the OT. So YMMV.
      >
      > Best,
      > Sev
      >
      >
      > ________________________________
      > From: Steven Calderwood <stevenc@...>
      > To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
      > Sent: Friday, June 28, 2013 9:36 AM
      > Subject: Re: [dita-users] Re: Assign Attributes to Figure Images in PDF Output
      >
      >
      >
      >
      >
      >
      >
      > Yes, thanks from here, too. As timing would have it, I was about to need to figure out how to do the floating as well. 
      >
      > Thanks much!
      > Steven
      > From: matt_kaatman <mkaatman@...>
      > Reply-To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
      > Date: Friday, June 28, 2013 11:28 AM
      > To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
      > Subject: [dita-users] Re: Assign Attributes to Figure Images in PDF Output
      >
      >
      >  
      > That's what I'm talking about! A solid answer from someone that knows what they're doing. :)
      >
      > --- In dita-users@yahoogroups.com, Severin Foreman <severin.foreman@> wrote:
      > >
      > > LOL! Thanks for the shout out, Matt. Actually, Mark and I go way back. We worked side-by-side on the team that implemented DITA at Epicor. :-)
      > >
      > > I think to achieve your goal, you have to use the fo:float object similar to what's shown below. and then set the attribute set for the fo:float. It might look like this (the following snippet is within the <xsl:template match="*[contains(@class,' topic/image
      > ')]"> template). Mark, the override for this template is in fo\commons.xsl\commons.xsl.
      > >
      > > <!-- Start snip -->
      > >  <xsl:when test="not(@placement = 'inline')">
      > > <!-- If the image is a child of a fig, put it in a float. Otherwise, just create a block. -->
      > >     <xsl:choose>
      > >         <xsl:when test="contains(parent::*/@class, ' topic/fig ')">
      > >                <fo:float xsl:use-attribute-sets="image__float">
      > >                     <fo:block xsl:use-attribute-sets="image__block" id="{@id}">
      > >                         <xsl:call-template name="placeImage">
      > >                             <xsl:with-param name="imageAlign" select="@align"/>
      > >                             <xsl:with-param name="href" select="@href"/>
      > >                             <xsl:with-param name="height" select="@height"/>
      > >                             <xsl:with-param name="width" select="@width"/>
      > >                         </xsl:call-template>
      > >                     </fo:block>
      > >               </fo:float>
      > >         </xsl:when>
      > >        <xsl:otherwise>
      > >              <fo:block xsl:use-attribute-sets="image__block" id="{@id}">
      > >                         <xsl:call-template name="placeImage">
      > >                             <xsl:with-param name="imageAlign" select="@align"/>
      > >                             <xsl:with-param name="href" select="@href"/>
      > >                             <xsl:with-param name="height" select="@height"/>
      > >                             <xsl:with-param name="width" select="@width"/>
      > >                         </xsl:call-template>
      > >                     </fo:block>
      > >        </xsl:otherwise>
      > >     </xsl:when>
      > > <!-- end snip -->
      > >
      > > Then in your custom_attrs.xsl file, you can create an override for the image__float attribute set where the alignment is set to right.
      > >
      > > Best,
      > > Severin
      > >
      > >
      > > ________________________________
      > > From: matt_kaatman <mkaatman@>
      > > To: dita-users@yahoogroups.com
      > > Sent: Friday, June 28, 2013 8:57 AM
      > > Subject: [dita-users] Re: Assign Attributes to Figure Images in PDF Output
      > >
      > >
      > > I've been patiently waiting for someone to give you an awesome reply.
      > >
      > > I can't wait any longer, I have to take a stab at it in hopes that one of our experts sees my post and cringes and then corrects me to turn this into a mini xslt/fo class.
      > >
      > > Disclaimer: I don't know what I'm doing.
      > >
      > > <xsl:template match="*[contains(@class,' topic/image ')]">
      > > <xsl:when test="ancestor::*[contains(@class, ' topic/fig ')]">
      > >   <fo:float xsl:use-attribute-sets="fig.image">
      > >   <xsl:apply-templates/>
      > >   </fo:float>
      > > </xsl:when>
      > > </xsl:template>
      > >
      > > Can someone explain all the ways that I'm wrong here? Paging Severin!
      > >
      > >
      > > --- In dita-users@yahoogroups.com, "msjensen8486" <msjensen8486@> wrote:
      > > >
      > > >
      > > > Hello DITA-Users,
      > > >
      > > > I am customizing a PDF output (XEP) to float images to the right side of the page so I can flow text steps next to the image. I am able to do this by setting <fo:float float="right"> and then in the DITA <image> tag, manually setting the align attribute
      > to "right".
      > > >
      > > > However we have hundreds of images, so I would rather use an <xsl:attribute-set> to automatically add this align attribute during the build. We are using the <fig><image> tag relationship in our DITA content, and what I've found in the DITA-OT is there
      > are attribute sets for "fig" and "fig.title", but not "fig.image." Using the align attribute in the "fig" attribute set blows up the build.
      > > >
      > > > Is there a way to set the align attribute in the "fig" attribute set? Or can I create a "fig.image" attribute set to define this attribute?
      > > >
      > > > Thanks,
      > > >
      > > > Mark Jensen
      > > > Epicor Software
      > > >
      > >
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >     http://docs.yahoo.com/info/terms/
      > >
      >
    • Severin Foreman
      I think what you want to do is put the image block inside of an object and set float= end . Usually for cases like this, I go to the topic.fo file
      Message 2 of 9 , Jun 28, 2013
      • 0 Attachment
        I think what you want to do is put the image block inside of an <fo:float> object and set float="end". Usually for cases like this, I go to the topic.fo file in the temp folder, manually tweak the FO, and run it through the rendering engine until I get the results I want. Then I go to the XSL and figure out how to code to that. 

        The AntennaHouse web site has some good FO float examples near the bottom of the following page. 

        Best,
        Sev


        From: msjensen8486 <msjensen8486@...>
        To: dita-users@yahoogroups.com
        Sent: Friday, June 28, 2013 4:58 PM
        Subject: [dita-users] Re: Assign Attributes to Figure Images in PDF Output


        Thanks Sev, that code definitely improved how the .pdf rendered the fo. Unfortunately the align attribute isn't allowed at <fo:flow>, <fo:block>, or <fo:external-graphic> nodes. However I was able to restrict the attribute sets and added the align attribute to the image attribute set and generate the .pdf without error, but I'm not receiving results. I still need to add the attributes to the <image> tag in the source .xml to get the results I want.

        I notice in the common.xsl/images.xsl that the imageAlign param is being set to @align. Does that shut off the attribute set in the output?

        All these questions for you. It's just like being back at the office again. ;-)

        --Mark


        --- In dita-users@yahoogroups.com, Severin Foreman <severin.foreman@...> wrote:
        >
        > Right on. Keep in mind that some of the information below, like the location of the XSL override file, is specific to how I set up PDF customizations at Epicor in version 1.5.1 of the OT. So YMMV.
        >
        > Best,
        > Sev
        >
        >
        > ________________________________
        >  From: Steven Calderwood <stevenc@...>
        > To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
        > Sent: Friday, June 28, 2013 9:36 AM
        > Subject: Re: [dita-users] Re: Assign Attributes to Figure Images in PDF Output

        >
        >

        >
        >
        >
        > Yes, thanks from here, too. As timing would have it, I was about to need to figure out how to do the floating as well. 
        >
        > Thanks much!
        > Steven
        > From: matt_kaatman <mkaatman@...>
        > Reply-To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
        > Date: Friday, June 28, 2013 11:28 AM
        > To: "dita-users@yahoogroups.com" <dita-users@yahoogroups.com>
        > Subject: [dita-users] Re: Assign Attributes to Figure Images in PDF Output
        >
        >
        >  
        > That's what I'm talking about! A solid answer from someone that knows what they're doing. :)
        >
        > --- In dita-users@yahoogroups.com, Severin Foreman <severin.foreman@> wrote:
        > >
        > > LOL! Thanks for the shout out, Matt. Actually, Mark and I go way back. We worked side-by-side on the team that implemented DITA at Epicor. :-)
        > >
        > > I think to achieve your goal, you have to use the fo:float object similar to what's shown below. and then set the attribute set for the fo:float. It might look like this (the following snippet is within the <xsl:template match="*[contains(@class,' topic/image
        >  ')]"> template). Mark, the override for this template is in fo\commons.xsl\commons.xsl.
        > >
        > > <!-- Start snip -->
        > >  <xsl:when test="not(@placement = 'inline')">
        > > <!-- If the image is a child of a fig, put it in a float. Otherwise, just create a block. -->
        > >     <xsl:choose>
        > >         <xsl:when test="contains(parent::*/@class, ' topic/fig ')">
        > >                <fo:float xsl:use-attribute-sets="image__float">
        > >                     <fo:block xsl:use-attribute-sets="image__block" id="{@id}">
        > >                         <xsl:call-template name="placeImage">
        > >                             <xsl:with-param name="imageAlign" select="@align"/>
        > >                             <xsl:with-param name="href" select="@href"/>
        > >                             <xsl:with-param name="height" select="@height"/>
        > >                             <xsl:with-param name="width" select="@width"/>
        > >                         </xsl:call-template>
        > >                     </fo:block>
        > >               </fo:float>
        > >         </xsl:when>
        > >        <xsl:otherwise>
        > >              <fo:block xsl:use-attribute-sets="image__block" id="{@id}">
        > >                         <xsl:call-template name="placeImage">
        > >                             <xsl:with-param name="imageAlign" select="@align"/>
        > >                             <xsl:with-param name="href" select="@href"/>
        > >                             <xsl:with-param name="height" select="@height"/>
        > >                             <xsl:with-param name="width" select="@width"/>
        > >                         </xsl:call-template>
        > >                     </fo:block>
        > >        </xsl:otherwise>
        > >     </xsl:when>
        > > <!-- end snip -->
        > >
        > > Then in your custom_attrs.xsl file, you can create an override for the image__float attribute set where the alignment is set to right.
        > >
        > > Best,
        > > Severin
        > >
        > >
        > > ________________________________
        > > From: matt_kaatman <mkaatman@>
        > > To: dita-users@yahoogroups.com
        > > Sent: Friday, June 28, 2013 8:57 AM
        > > Subject: [dita-users] Re: Assign Attributes to Figure Images in PDF Output
        > >
        > >
        > > I've been patiently waiting for someone to give you an awesome reply.
        > >
        > > I can't wait any longer, I have to take a stab at it in hopes that one of our experts sees my post and cringes and then corrects me to turn this into a mini xslt/fo class.
        > >
        > > Disclaimer: I don't know what I'm doing.
        > >
        > > <xsl:template match="*[contains(@class,' topic/image ')]">
        > > <xsl:when test="ancestor::*[contains(@class, ' topic/fig ')]">
        > >   <fo:float xsl:use-attribute-sets="fig.image">
        > >   <xsl:apply-templates/>
        > >   </fo:float>
        > > </xsl:when>
        > > </xsl:template>
        > >
        > > Can someone explain all the ways that I'm wrong here? Paging Severin!
        > >
        > >
        > > --- In dita-users@yahoogroups.com, "msjensen8486" <msjensen8486@> wrote:
        > > >
        > > >
        > > > Hello DITA-Users,
        > > >
        > > > I am customizing a PDF output (XEP) to float images to the right side of the page so I can flow text steps next to the image. I am able to do this by setting <fo:float float="right"> and then in the DITA <image> tag, manually setting the align attribute
        >  to "right".
        > > >
        > > > However we have hundreds of images, so I would rather use an <xsl:attribute-set> to automatically add this align attribute during the build. We are using the <fig><image> tag relationship in our DITA content, and what I've found in the DITA-OT is there
        >  are attribute sets for "fig" and "fig.title", but not "fig.image." Using the align attribute in the "fig" attribute set blows up the build.
        > > >
        > > > Is there a way to set the align attribute in the "fig" attribute set? Or can I create a "fig.image" attribute set to define this attribute?
        > > >
        > > > Thanks,
        > > >
        > > > Mark Jensen
        > > > Epicor Software
        > > >
        > >
        > >
        > >
        > > ------------------------------------
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >     http://docs.yahoo.com/info/terms/
        > >
        >




        ------------------------------------

        Yahoo! Groups Links

        <*> To visit your group on the web, go to:
            http://groups.yahoo.com/group/dita-users/

        <*> Your email settings:
            Individual Email | Traditional

        <*> To change settings online go to:
            http://groups.yahoo.com/group/dita-users/join
            (Yahoo! ID required)

        <*> To change settings via email:
            dita-users-digest@yahoogroups.com
            dita-users-fullfeatured@yahoogroups.com

        <*> To unsubscribe from this group, send an email to:
            dita-users-unsubscribe@yahoogroups.com

        <*> Your use of Yahoo! Groups is subject to:
            http://docs.yahoo.com/info/terms/



      Your message has been successfully submitted and would be delivered to recipients shortly.