Tim Arnold | 10 Nov 19:16 2014
Picon

Re: help with a simple customization template

Thanks for that push in the right direction Peter. It was indeed the missing fileref--when I populate that in the source xml, my template does get picked up.

Probably this is an interesting corner-case (or maybe not that interesting), but thanks for helping me get to back to work!
--Tim


On Mon, Nov 10, 2014 at 11:48 AM, Peter Desjardins <peter.desjardins.us <at> gmail.com> wrote:
When I'm not sure whether my customization template is being used, I
drop in an <xsl:message />.

<xsl:template match="d:inlineequation/d:inlinemediaobject[ <at> remap='math']/d:imageobject/d:imagedata">
    <xsl:message>FINDME: ***********************************</xsl:message>
    <xsl:element name="img">
      <xsl:attribute name="class">math</xsl:attribute>
    </xsl:element>
  </xsl:template>

If you see "FINDME" in your console output, you know the template is being used.

Your empty imagedata element seems like it's likely to cause confusion
since you're not including any imagedata. But I haven't looked into
the default handling of imageobject and imagedata.

Peter

On Mon, Nov 10, 2014 at 11:25 AM, Tim Arnold <jtim.arnold <at> gmail.com> wrote:
> hi, I have looked at this and looked at it and still cannot see what I'm
> doing wrong.
> I would appreciate another set of eyes to show me the error.Trying to match
> on an 'inlineequation' to produce an 'img' element, but getting a 'span'
> instead. I've cut it down to this example:
>
> The XSLT:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:d="http://docbook.org/ns/docbook"
>   version="1.0" exclude-result-prefixes="d">
>
>   <xsl:include href="path/to/docbook/xsl-1.78.1/html/onechunk.xsl" />
>
>   <xsl:template
> match="d:inlineequation/d:inlinemediaobject[ <at> remap='math']/d:imageobject/d:imagedata">
>     <xsl:element name="img">
>       <xsl:attribute name="class">math</xsl:attribute>
>     </xsl:element>
>   </xsl:template>
> </xsl:stylesheet>
>
> This DocBook 5 XML:
> <article xmlns="http://docbook.org/ns/docbook"
>   xmlns:mml="http://www.w3.org/1998/Math/MathML"
>   xmlns:xl="http://www.w3.org/1999/xlink">
>  <section remap="section" xml:id="a0000000002">
>   <info><title>Introduction</title></info>
>    For example,
>   <inlineequation>
>   <inlinemediaobject remap="math">
>     <imageobject role="math_images">
>       <imagedata role="math" />
>     </imageobject>
>     <textobject role="tex">
>       <phrase>$\alpha +\beta {}x+\varepsilon $</phrase>
>     </textobject>
>   </inlinemediaobject>
> </inlineequation>.
> </section>
> </article>
>
> And I get this result, which means that my template is not getting used,
> right? Can you see what I'm doing wrong? I omit the HTML header and intro
> material:
> <div class="section">
>       <div class="titlepage">
>         <div>
>           <div>
>             <h2 class="title" style="clear: both">
>               <a name="a0000000002"></a>
>               Introduction
>             </h2>
>           </div>
>         </div>
>       </div>
>       For example,
>       <span class="inlinemediaobject"></span>
>       .
>     </div>
>
> thanks in advance,
> --Tim
>

Tim Arnold | 10 Nov 17:25 2014
Picon

help with a simple customization template

hi, I have looked at this and looked at it and still cannot see what I'm doing wrong. 
I would appreciate another set of eyes to show me the error.Trying to match on an 'inlineequation' to produce an 'img' element, but getting a 'span' instead. I've cut it down to this example:

The XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:d="http://docbook.org/ns/docbook"
  version="1.0" exclude-result-prefixes="d">

  <xsl:include href="path/to/docbook/xsl-1.78.1/html/onechunk.xsl" />

  <xsl:template match="d:inlineequation/d:inlinemediaobject[ <at> remap='math']/d:imageobject/d:imagedata">
    <xsl:element name="img">
      <xsl:attribute name="class">math</xsl:attribute>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

This DocBook 5 XML:
<article xmlns="http://docbook.org/ns/docbook"
  xmlns:mml="http://www.w3.org/1998/Math/MathML"
  xmlns:xl="http://www.w3.org/1999/xlink">
 <section remap="section" xml:id="a0000000002">
  <info><title>Introduction</title></info>
   For example,
  <inlineequation>
  <inlinemediaobject remap="math">
    <imageobject role="math_images">
      <imagedata role="math" />
    </imageobject>
    <textobject role="tex">
      <phrase>$\alpha +\beta {}x+\varepsilon $</phrase>
    </textobject>
  </inlinemediaobject>
</inlineequation>.
</section>
</article>

And I get this result, which means that my template is not getting used, right? Can you see what I'm doing wrong? I omit the HTML header and intro material:
<div class="section">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both">
              <a name="a0000000002"></a>
              Introduction
            </h2>
          </div>
        </div>
      </div>
      For example,
      <span class="inlinemediaobject"></span>
      .
    </div>

thanks in advance,
--Tim

Picon

problem with SVG in Docbook

Hi

I am changing some illustrations from png to svg, and I have encountered
what I think is a bug in some stylesheet.

My input

    <imageobject role="html">
         <imagedata  format="SVG"
                     fileref="../code/specgraphics/crashnavi.svg"
                     scale="75"/>
    </imageobject>

generated output html:

    <div class="mediaobject">
      <object style="width: 405; " type="image/svg+xml"
data="../code/specgraphics/crashnavi.svg"/>
    </div>

Problem: the style attribute in the object element is calculated
correctly but CSS requires a unit, eg "px". Resultingly the width is not
interpreted on the html page.

Is there any additional spec I can do to work around the problem?
Has it been reported and is there fix on the way?

I am using docbook-xsl-ns-stylesheets-1.78.0

Cheers
Niels

Jirka Kosek | 29 Oct 18:11 2014
Picon

Re: [WebHelp] Incorrect initial scroll to anchor in Chrome

On 27.10.2014 19:04, Jan Tosovsky wrote:
> This seems to be caused by the following script located in the main.js file:
> 
> var hash = window.location.hash;
> if (hash) { 
>    var targetOffset = $(hash).offset().top - 120;
>    $('html,body').animate({scrollTop: targetOffset}, 200);
>    return false;
> }

Could you try replacing $('html,body') with $('#content'). I recall that
there were some problems related to former selector, but I'm not sure
whether this will help here.

					Jirka

--

-- 
------------------------------------------------------------------
  Jirka Kosek     e-mail: jirka <at> kosek.cz     http://www.kosek.cz
------------------------------------------------------------------
  Profesionální školení a poradenství v oblasti technologií XML.
       Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
  http://docbook.cz    Stránky o dokumentačním formátu DocBook
  http://xmlguru.cz    Blog mostly about XML for English readers
------------------------------------------------------------------

Janice Manwiller | 28 Oct 13:02 2014

Checking for different types of links (xref vs link/linkend vs link/href)

Is there a way in the customization layer to check for different types of links?

What I want to do is in PDFs, do the following:

- For xref links (links within a guide) and link/href links (links to websites), do the standard blue link text

- For link/linkend links (links to other guides), do not have any formatting.

The reason for this is that for our PDF output, where each guide is a separate file, the links between guides do not work. They're currently formatted as links, but aren't clickable.

In the WebHelp output, which is generated as a single collection, the links do work, so I want to leave them as links in the source file.

I know that olinks are designed to be used for links between documents, but my understanding is that olinks do not work in WebHelp output.

I tried a workaround in the FO XSL file where only xref links were blue:

  <xsl:attribute-set name="xref.properties">
   
<xsl:attribute name="color">
       
<xsl:choose>
               <xsl:when test="self::xref">blue</xsl:when>
                <xsl:otherwise>inherit</xsl:otherwise>
         </xsl:choose>
      
</xsl:attribute>
  </xsl:attribute-set>

But ended up with no formatting on any links.

Thanks,

Janice
David Cramer | 28 Oct 07:29 2014
Picon

Re: [WebHelp] Incorrect initial scroll to anchor in Chrome

On 10/27/14, 1:04 PM, Jan Tosovsky wrote:
...
> While target offset is -195 in FF, it is 2200 in Chrome. The required anchor
> is not scrolled precisely to its location, but ca 300 px towards the bottom.
> However, on page reload it is sometimes correct, sometimes more or less than
> the initial value. This inconsistency is really weird.
> 
> I've found several threads mentioning incorrect Chrome behaviour when
> determining offset top value on StackOverflow, but it is not very clear to
> me if this is our case.
> 
> Has anybody any experience with this or fix?

As you've noticed, that code is trying to compensate for the fact that
there's a fixed header and links to anchors in a page would otherwise
appear under the fixed header (i.e. at the top of the window). I've
recently come across a better solution to that problem that uses only
css. It goes something like this (assuming you're linking to <a/> tags
and assuming a header-height of 195px):

  a:before {
      display: block;
      content: " ";
      margin-top: -195px;
      height: 195px;
      visibility: hidden;
      z-index: -1;
    }

Adjust the selector as needed if the links are to div tags or whatever.
In the case of the DocBook xslts, I think a and div tags that have id
attributes would be the right things to add this rule to.

This strategy is much easier to maintain if you're using sass/scss
because you can use variables, defining $header-height in one place and
then reusing it to define the height of the header and the offests in
rules like this.

My suggestion would be to rip out the javascript and move to a solution
like this.

Regards,
David
Jan Tosovsky | 27 Oct 19:04 2014
Picon

[WebHelp] Incorrect initial scroll to anchor in Chrome

Dear All,

I've noticed incorrect scrolling the page in Chrome when the URL contains a
hash character.

This seems to be caused by the following script located in the main.js file:

var hash = window.location.hash;
if (hash) { 
   var targetOffset = $(hash).offset().top - 120;
   $('html,body').animate({scrollTop: targetOffset}, 200);
   return false;
}

While target offset is -195 in FF, it is 2200 in Chrome. The required anchor
is not scrolled precisely to its location, but ca 300 px towards the bottom.
However, on page reload it is sometimes correct, sometimes more or less than
the initial value. This inconsistency is really weird.

I've found several threads mentioning incorrect Chrome behaviour when
determining offset top value on StackOverflow, but it is not very clear to
me if this is our case.

Has anybody any experience with this or fix?

Thanks, Jan
jmt | 23 Oct 12:08 2014
Picon

footnotes author

Hello list,

I have a document with notes from different authors, e.g.

<para>
    some text
    <footnote role='author'>bla bla</footnote>
    another sentence
    <footnote role='translator'>glop glop</footnote>
</para>

The document is to be rendered in html, epub and pdf. How do I attribute the 
notes according to the role, e.g.

[1] [author] bla la
[2] [translator] glop glop

Thanks in advance !

jmt

--

-- 

          http://www.dxdydz.net

            Jean-Marie Thomas

Informatique scientifique et technique
Richard Hamilton | 22 Oct 18:48 2014
Picon

epub3 and named entities

It looks as though the next version of epubcheck may reject epub3 files that use named character entities
(&amp;, etc.).

Right now, the stylesheets will generate at least some of these, even if you use the numeric equivalent
(e.g., if you use &#38; for ampersand in your source, the output will be &amp;).

Is there an option that will keep Saxon (which is what we currently use) from making this change? Or are there
options with other processors that might be a better choice?

Thanks,
Dick Hamilton
-------
XML Press
XML for Technical Communicators
http://xmlpress.net
hamilton <at> xmlpress.net
Olivier Ishacian | 21 Oct 19:41 2014

[ANN] Release of XMLmind XML Editor v6.1

XMLmind is happy to announce the version 6.1 of XMLmind XML Editor.
    _____________________________________________

XMLmind XML Editor Evaluation Edition v6.1 can be downloaded from
http://www.xmlmind.com/xmleditor/download.shtml

Professional Edition users, please upgrade using this form:
http://www.xmlmind.com/store/download.php

(The above form is usually accessed through
http://www.xmlmind.com/xmleditor/upgrade.html.)
    _____________________________________________

XMLmind XML Editor v6.1 (October 20, 2014)
------------------------------------------

* Many enhancements making XMLmind XML Editor more powerful
   and more comfortable to use.

* Some important bug fixes.

* New documentation. See below.
    _____________________________________________

More information:
http://www.xmlmind.com/xmleditor/changes.html

XMLmind XML Editor - Support of XPath 1.0
http://www.xmlmind.com/xmleditor/_distrib/doc/xpathsupport/index.html

XMLmind XML Editor - How to adapt "Paste from Word" to your needs
http://www.xmlmind.com/xmleditor/_distrib/doc/pastefromword/index.html
Janice Manwiller | 16 Oct 13:44 2014

Trouble formatting PDF TOC entries

I'm trying to update the formatting of a PDF TOC. I mostly want to add additional space above and bold the chapter entries.

I found the following sample for toc.line.properties in the DocBook XSL reference, and as a test added it to my FO stylesheet.

<xsl:attribute-set name="toc.line.properties"> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="font-weight"> <xsl:when test="self::chapter | self::preface | self::appendix">bold</xsl:when> <xsl:otherwise>normal</xsl:otherwise> </xsl:attribute> </xsl:attribute-set>
According to the guide, this should make all entries 10pt and chapter entries bold.

However, when I try to generate the DocBook output using our maven docbkx tool, it doesn't generate at all, and I get an error indicating that a "when" element must always be enclosed by a "choose" element.

If I add the choose element, like:
<xsl:attribute-set name="toc.line.properties"> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="font-weight"> <choose> <xsl:when test="self::chapter | self::preface | self::appendix">bold</xsl:when> <xsl:otherwise>normal</xsl:otherwise> </choose> </xsl:attribute> </xsl:attribute-set>
then the output generates, but there is no effect on the TOC formatting. The chapter entries aren't bold.

Any ideas on how to get this to work?

Thanks,

Janice

Gmane