← Prev in month ← Prev in thread
Next in thread → Next in month →

Fw: Intelligent ulink for PDF generated files

From
David <>
Date
2007-02-19T13:19:33+00:00
ID
Thread
Fw: Intelligent ulink for PDF generated files
Dear members,

 

When I generates my document into PDF format every time I have on my document <ulink>, like this:

 

<ulink url="http://www.eclipse.org">Eclipse</ulink>

 

I get:

 

Eclipse[www.eclipse.org]

 

but if I refers many times to Eclipse on the same paragraph, I get the same output information, so it doesn't detect that on this paragraph was referenced Eclipse once, so it is not necessary to informs about the URL all the time.

 

My idea is to allow the user configurate this behaviour, the following strategies could be implemented:

- Reference once per paragraph or,

- Reference once per page or,

- Reference once per section or,

- Reference once per chapter or,

- Reference once per document

 

This is my suggestion, but I don't know how to implement it, my XSL level is poor, but probably some of you have thought about this problem before than me.

 

Thanks in advance,

 

On the files xref.xsl there is the following information about ulink, so I think it should be the starting point:

 

==============================================

<xsl:template match="ulink" name="ulink">
  <fo:basic-link xsl:use-attribute-sets="xref.properties">
    <xsl:attribute name="external-destination">
      <xsl:call-template name="fo-external-image">
        <xsl:with-param name="filename" select="@url"/>
      </xsl:call-template>
    </xsl:attribute>

    <xsl:choose>
      <xsl:when test="count(child::node())=0">
        <xsl:call-template name="hyphenate-url">
          <xsl:with-param name="url" select="@url"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates/>
      </xsl:otherwise>
    </xsl:choose>
  </fo:basic-link>

  <xsl:if test="count(child::node()) != 0
                and string(.) != @url
                and $ulink.show != 0">
    <!-- yes, show the URI -->
    <xsl:choose>
      <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
        <fo:footnote>
          <xsl:call-template name="ulink.footnote.number"/>
          <fo:footnote-body xsl:use-attribute-sets="footnote.properties">
            <fo:block>
             
 <xsl:call-template name="ulink.footnote.number"/>
              <xsl:text> </xsl:text>
              <fo:inline>
                <xsl:value-of select="@url"/>
              </fo:inline>
            </fo:block>
          </fo:footnote-body>
        </fo:footnote>
      </xsl:when>
      <xsl:otherwise>
        <fo:inline
 hyphenate="false">
          <xsl:text> [</xsl:text>
          <xsl:call-template name="hyphenate-url">
            <xsl:with-param name="url" select="@url"/>
          </xsl:call-template>
          <xsl:text>]</xsl:text>
        </fo:inline>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>
</xsl:template>

 

 

 

<xsl:template name="ulink.footnote.number">
  <fo:inline xsl:use-attribute-sets="footnote.mark.properties">
    <xsl:choose>
      <xsl:when test="$fop.extensions != 0">
        <xsl:attribute name="vertical-align">super</xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="baseline-shift">super</xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:variable name="fnum">
      <!-- FIXME: list in @from is probably not complete -->
      <xsl:number level="any"
 
                  from="chapter|appendix|preface|article|refentry|bibliography[not(parent::article)]" 
                  count="footnote[not(@label)][not(ancestor::tgroup)]|ulink[node()][@url != .][not(ancestor::footnote)]" 
                  format="1"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
        <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
      </xsl:when>
     
 <xsl:otherwise>
        <xsl:number value="$fnum" format="{$footnote.number.format}"/>
      </xsl:otherwise>
    </xsl:choose>
  </fo:inline>
</xsl:template>
===================================================

 

David

 

 

Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.

Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
← Prev in month ← Prev in thread
Next in thread → Next in month →