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

Re: [dita-users] Highlighting conrefs

Expand Messages
  • Radu Coravu
    Hi Matt, Looking in the merged XML file which is generated in the temporary files directory by the PDF transformation, I noticed that the @xtrf attribute on
    Message 1 of 7 , Sep 2, 2012
    • 0 Attachment
      Hi Matt,

      Looking in the merged XML file which is generated in the temporary files
      directory by the PDF transformation, I noticed that the @xtrf attribute
      on the conreffed element (the attribute which shows the path to the file
      from where the content was retrieved) is different than the @xtrf
      attribute on the parent element (because most of the times conreffed
      content comes from different topics).

      Looking in the stylesheet:

      > OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/commons.xsl

      it contains an XSLT template called:

      > <xsl:template name="commonattributes">......

      Maybe you could customize it and add in it an additional <xsl:if>,
      something like:

      > <xsl:if test="@xtrf != ancestor::node()[1]/@xtrf">
      > <xsl:attribute name="border-top-style">solid</xsl:attribute>
      > <xsl:attribute name="border-top-width">1pt</xsl:attribute>
      > <xsl:attribute name="border-top-color">black</xsl:attribute>
      > <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
      > <xsl:attribute name="border-bottom-width">1pt</xsl:attribute>
      > <xsl:attribute name="border-bottom-color">black</xsl:attribute>
      > <xsl:attribute name="border-right-style">solid</xsl:attribute>
      > <xsl:attribute name="border-right-width">1pt</xsl:attribute>
      > <xsl:attribute name="border-right-color">black</xsl:attribute>
      > <xsl:attribute name="border-left-style">solid</xsl:attribute>
      > <xsl:attribute name="border-left-width">1pt</xsl:attribute>
      > <xsl:attribute name="border-left-color">black</xsl:attribute>
      > </xsl:if>

      I'm not sure this would work in all cases, it worked for a small example
      I created.

      Regards,
      Radu

      Radu Coravu
      <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
      http://www.oxygenxml.com

      On 8/31/2012 10:05 PM, matt_kaatman wrote:
      > I would like to style my conrefs so that during our internal PDF reviews
      > we can quickly recognize what content is conrefed.
      >
      > I'd just like to make them slightly off-white or grey or stick a border
      > on them or something along those lines.
      >
      > Any thoughts on how to do this?
      >
      >
    • matt_kaatman
      This works really well Radu! I modified it slightly:
      Message 2 of 7 , Sep 4, 2012
      • 0 Attachment
        This works really well Radu!

        I modified it slightly:
        <!-- Process common attributes -->
        <xsl:template name="commonattributes">
        <xsl:apply-templates select="@id"/>
        <xsl:if test="@xtrf != ancestor::node()[1]/@xtrf">
        <xsl:attribute name="background-color">#FFFF99</xsl:attribute>
        </xsl:if>
        </xsl:template>

        The only unintentional artifact I've seen so far is that I had one <chapter that had a direct href instead of only being a container. The entire chapter was getting highlighted.

        I moved the contents out of that chapter and into the first topic and the problem is resolved.

        This is a really great tool for us because when we're reviewing the document we can quickly see any instance of text that we expected to be conrefed.

        Thank you!
        Matt

        --- In dita-users@yahoogroups.com, Radu Coravu <radu_coravu@...> wrote:
        >
        > Hi Matt,
        >
        > Looking in the merged XML file which is generated in the temporary files
        > directory by the PDF transformation, I noticed that the @xtrf attribute
        > on the conreffed element (the attribute which shows the path to the file
        > from where the content was retrieved) is different than the @xtrf
        > attribute on the parent element (because most of the times conreffed
        > content comes from different topics).
        >
        > Looking in the stylesheet:
        >
        > > OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/commons.xsl
        >
        > it contains an XSLT template called:
        >
        > > <xsl:template name="commonattributes">......
        >
        > Maybe you could customize it and add in it an additional <xsl:if>,
        > something like:
        >
        > > <xsl:if test="@xtrf != ancestor::node()[1]/@xtrf">
        > > <xsl:attribute name="border-top-style">solid</xsl:attribute>
        > > <xsl:attribute name="border-top-width">1pt</xsl:attribute>
        > > <xsl:attribute name="border-top-color">black</xsl:attribute>
        > > <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
        > > <xsl:attribute name="border-bottom-width">1pt</xsl:attribute>
        > > <xsl:attribute name="border-bottom-color">black</xsl:attribute>
        > > <xsl:attribute name="border-right-style">solid</xsl:attribute>
        > > <xsl:attribute name="border-right-width">1pt</xsl:attribute>
        > > <xsl:attribute name="border-right-color">black</xsl:attribute>
        > > <xsl:attribute name="border-left-style">solid</xsl:attribute>
        > > <xsl:attribute name="border-left-width">1pt</xsl:attribute>
        > > <xsl:attribute name="border-left-color">black</xsl:attribute>
        > > </xsl:if>
        >
        > I'm not sure this would work in all cases, it worked for a small example
        > I created.
        >
        > Regards,
        > Radu
        >
        > Radu Coravu
        > <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
        > http://www.oxygenxml.com
        >
        > On 8/31/2012 10:05 PM, matt_kaatman wrote:
        > > I would like to style my conrefs so that during our internal PDF reviews
        > > we can quickly recognize what content is conrefed.
        > >
        > > I'd just like to make them slightly off-white or grey or stick a border
        > > on them or something along those lines.
        > >
        > > Any thoughts on how to do this?
        > >
        > >
        >
      • matt_kaatman
        Hey Everyone, Thanks to Jarno who got me started and Radu who found the final solution! In: /DITA-OT/xsl/preprocess/conrefImpl.xsl My Oxygen 1.5.4 version is
        Message 3 of 7 , Sep 6, 2012
        • 0 Attachment
          Hey Everyone,

          Thanks to Jarno who got me started and Radu who found the final solution!

          In:
          /DITA-OT/xsl/preprocess/conrefImpl.xsl

          My Oxygen 1.5.4 version is line:975
          <xsl:for-each select="@*">

          I added:
          <xsl:attribute name="IS_CONREF">true</xsl:attribute>

          Then in my fo/xsl/commons.xsl override:
          <!-- Process common attributes -->
          <xsl:template name="commonattributes">
          <xsl:apply-templates select="@id"/>
          <xsl:if test="//bookmap//@outputclass='debug'">
          <xsl:if test="@IS_CONREF">
          <xsl:attribute name="background-color">#FFFF99</xsl:attribute>
          </xsl:if>
          </xsl:if>
          </xsl:template>

          Lastly, on my bookmap, I set outputclass=debug to turn it on.

          It works flawlessly, every conref in the PDF output is highlighted.

          Next I am going to work on coloring the text of everything that has translate=no. Currently, I can make it work if it's set within the topic, but it doesn't seem to work if it's set in another topic and conrefed in.

          I hope this is as helpful for others as it was for me!
          Matt
        • Leigh White
          Just tried this and it works beautifully. Thanks for posting, Matt! Now, if you want to try doing the same for keyrefs, that s be a great thing to know how to
          Message 4 of 7 , Sep 6, 2012
          • 0 Attachment
            Just tried this and it works beautifully. Thanks for posting, Matt! Now, if you want to try doing the same for keyrefs, that's be a great thing to know how to do as well! (Read: I want to know how to do it :-)

            Leigh

            --- In dita-users@yahoogroups.com, "matt_kaatman" <mkaatman@...> wrote:
            >
            > Hey Everyone,
            >
            > Thanks to Jarno who got me started and Radu who found the final solution!
            >
            > In:
            > /DITA-OT/xsl/preprocess/conrefImpl.xsl
            >
            > My Oxygen 1.5.4 version is line:975
            > <xsl:for-each select="@*">
            >
            > I added:
            > <xsl:attribute name="IS_CONREF">true</xsl:attribute>
            >
            > Then in my fo/xsl/commons.xsl override:
            > <!-- Process common attributes -->
            > <xsl:template name="commonattributes">
            > <xsl:apply-templates select="@id"/>
            > <xsl:if test="//bookmap//@outputclass='debug'">
            > <xsl:if test="@IS_CONREF">
            > <xsl:attribute name="background-color">#FFFF99</xsl:attribute>
            > </xsl:if>
            > </xsl:if>
            > </xsl:template>
            >
            > Lastly, on my bookmap, I set outputclass=debug to turn it on.
            >
            > It works flawlessly, every conref in the PDF output is highlighted.
            >
            > Next I am going to work on coloring the text of everything that has translate=no. Currently, I can make it work if it's set within the topic, but it doesn't seem to work if it's set in another topic and conrefed in.
            >
            > I hope this is as helpful for others as it was for me!
            > Matt
            >
          • matt_kaatman
            Hey Leigh, I didn t look at keyrefs yet, but Jarno did open a bug to make this easier in the future for keyref and conref.
            Message 5 of 7 , Sep 7, 2012
            • 0 Attachment
              Hey Leigh,

              I didn't look at keyrefs yet, but Jarno did open a bug to make this easier in the future for keyref and conref.

              https://github.com/dita-ot/dita-ot/issues/1381

              I'd also like to be able to color text that was set to translate=no but it looks like there's a bug that keeps translate from propagating through a conref. (Not sure on keyref)

              Matt

              --- In dita-users@yahoogroups.com, "Leigh White" <lwwhite5@...> wrote:
              >
              > Just tried this and it works beautifully. Thanks for posting, Matt! Now, if you want to try doing the same for keyrefs, that's be a great thing to know how to do as well! (Read: I want to know how to do it :-)
              >
              > Leigh
              >
              > --- In dita-users@yahoogroups.com, "matt_kaatman" <mkaatman@> wrote:
              > >
              > > Hey Everyone,
              > >
              > > Thanks to Jarno who got me started and Radu who found the final solution!
              > >
              > > In:
              > > /DITA-OT/xsl/preprocess/conrefImpl.xsl
              > >
              > > My Oxygen 1.5.4 version is line:975
              > > <xsl:for-each select="@*">
              > >
              > > I added:
              > > <xsl:attribute name="IS_CONREF">true</xsl:attribute>
              > >
              > > Then in my fo/xsl/commons.xsl override:
              > > <!-- Process common attributes -->
              > > <xsl:template name="commonattributes">
              > > <xsl:apply-templates select="@id"/>
              > > <xsl:if test="//bookmap//@outputclass='debug'">
              > > <xsl:if test="@IS_CONREF">
              > > <xsl:attribute name="background-color">#FFFF99</xsl:attribute>
              > > </xsl:if>
              > > </xsl:if>
              > > </xsl:template>
              > >
              > > Lastly, on my bookmap, I set outputclass=debug to turn it on.
              > >
              > > It works flawlessly, every conref in the PDF output is highlighted.
              > >
              > > Next I am going to work on coloring the text of everything that has translate=no. Currently, I can make it work if it's set within the topic, but it doesn't seem to work if it's set in another topic and conrefed in.
              > >
              > > I hope this is as helpful for others as it was for me!
              > > Matt
              > >
              >
            • Joe Pairman
              Thanks for sharing this, Matt. Interesting you mention highlighting in connection with translation. A while ago, we were thinking of highlighting referenced
              Message 6 of 7 , Sep 7, 2012
              • 0 Attachment
                Thanks for sharing this, Matt. Interesting you mention highlighting in connection with translation. A while ago, we were thinking of highlighting referenced content to make things easier for translators. In fact, as we only reference certain elements, the translators quickly learned to recognize referenced content, but I'm saving this solution in case it's needed in the future.

                Cheers,
                Joe

                On Fri, Sep 7, 2012 at 9:25 PM, matt_kaatman <mkaatman@...> wrote:
                 

                Hey Leigh,

                I didn't look at keyrefs yet, but Jarno did open a bug to make this easier in the future for keyref and conref.

                https://github.com/dita-ot/dita-ot/issues/1381

                I'd also like to be able to color text that was set to translate=no but it looks like there's a bug that keeps translate from propagating through a conref. (Not sure on keyref)

                Matt



                --- In dita-users@yahoogroups.com, "Leigh White" <lwwhite5@...> wrote:
                >
                > Just tried this and it works beautifully. Thanks for posting, Matt! Now, if you want to try doing the same for keyrefs, that's be a great thing to know how to do as well! (Read: I want to know how to do it :-)
                >
                > Leigh
                >
                > --- In dita-users@yahoogroups.com, "matt_kaatman" <mkaatman@> wrote:
                > >
                > > Hey Everyone,
                > >
                > > Thanks to Jarno who got me started and Radu who found the final solution!
                > >
                > > In:
                > > /DITA-OT/xsl/preprocess/conrefImpl.xsl
                > >
                > > My Oxygen 1.5.4 version is line:975
                > > <xsl:for-each select="@*">
                > >
                > > I added:
                > > <xsl:attribute name="IS_CONREF">true</xsl:attribute>
                > >
                > > Then in my fo/xsl/commons.xsl override:
                > > <!-- Process common attributes -->
                > > <xsl:template name="commonattributes">
                > > <xsl:apply-templates select="@id"/>
                > > <xsl:if test="//bookmap//@outputclass='debug'">
                > > <xsl:if test="@IS_CONREF">
                > > <xsl:attribute name="background-color">#FFFF99</xsl:attribute>
                > > </xsl:if>
                > > </xsl:if>
                > > </xsl:template>
                > >
                > > Lastly, on my bookmap, I set outputclass=debug to turn it on.
                > >
                > > It works flawlessly, every conref in the PDF output is highlighted.
                > >
                > > Next I am going to work on coloring the text of everything that has translate=no. Currently, I can make it work if it's set within the topic, but it doesn't seem to work if it's set in another topic and conrefed in.
                > >
                > > I hope this is as helpful for others as it was for me!
                > > Matt
                > >
              Your message has been successfully submitted and would be delivered to recipients shortly.