Next in thread → Next in month →

Re: [docbook-apps] Change error message in output for missing xinclude?

From
Bob Stayton <>
Date
2007-10-16T16:29:50+00:00
ID
01f801c81011$b7345dd0$6400a8c0@totoro
Thread
Re: [docbook-apps] Change error message in output for missing xinclude?
I'm not sure if anyone mentioned this, but you 
could customize the scripting to handle unresolved xincludes. You create a 
template that matches on xi:include to output your own message.  The 
default message comes from this template that matches on any unrecognized 
element:

 

<xsl:template match="*">
  
<xsl:message>
    <xsl:text>Element 
</xsl:text>
    <xsl:value-of 
select="local-name(.)"/>
    <xsl:text> in namespace 
'</xsl:text>
    <xsl:value-of 
select="namespace-uri(.)"/>
    <xsl:text>' 
encountered</xsl:text>
    <xsl:if 
test="parent::*">
      <xsl:text> in 
</xsl:text>
      <xsl:value-of 
select="name(parent::*)"/>
    
</xsl:if>
    <xsl:text>, but no template 
matches.</xsl:text>
  </xsl:message>

 

  <span style="color: 
red">
    
<xsl:text>&lt;</xsl:text>
    <xsl:value-of 
select="name(.)"/>
    
<xsl:text>&gt;</xsl:text>
    
<xsl:apply-templates/>
    
<xsl:text>&lt;/</xsl:text>
    
<xsl:value-of select="name(.)"/>
    
<xsl:text>&gt;</xsl:text>
  
</span>
</xsl:template>

 

You could create a custom template like 
this:

 

<xsl:template match="xi:include">
  
<span class="EmptyInclude">
    
<xsl:text>Currently there is no Data available.</xsl:text>
  
</span>
</xsl:template>

 

and perhaps add an xsl:message if you need 
it.

 

Bob Stayton
Sagehill Enterprises
DocBook Consulting


 

 

  
----- Original Message ----- 

  
From: 
  Schramm, Martin 

  
To: Phil Borlin ; David Cramer ; 
  Markus Hoenicka 

  
Cc:  
  

  
Sent: Tuesday, October 16, 2007 7:07 
  AM

  
Subject: AW: [docbook-apps] Change error 
  message in output for missing xinclude?

  

  
Phil, David and Markus!

  
Thanks a lot for your help. I have adjusted my mother 
  file by adding the <xi:fallback> lines. Now the FO/PDF and HTML output 
  looks good and supplies proper information.

  
I agree to Markus' opinion, that adjusting the 
  scripting (which produces the referenced files) would be even more effective. 
  But we have no influence over it.

  
Best wishes,

  
Martin

  
 

  
    

    
    Von: Phil Borlin 
    [mailto:] 
Gesendet: Montag, 15. Oktober 
    2007 19:10
An: Schramm, Martin
Betreff: Re: 
    [docbook-apps] Change error message in output for missing 
    xinclude?

    

This is very 
    easy:

<xi:include  href="intro.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:fallback>
    <para>Currently 
    there is no data available</para> 
    
  </xi:fallback>
</xi:include> 
    

Check out: http://www.sagehill.net/docbookxsl/ModularDoc.html#XIncludeFallback

    

    
Phil

On 10/15/07, Schramm, Martin <> 
    wrote:
> Dear list,
> 
> I like to ask you for support in 
    the following case: 
> 
> We have a DB "mother" document, which 
    contains lots of xinclude
> references to other files. Many of these 
    referenced files are generated
> by scripts (containing tables with 
    test results). These generated files 
> are written in valid DocBook 
    4.5 .
> 
> But sometimes there is no data to be published in 
    those files. So there
> is no file and the specific folder is empty, 
    where the xinclude
> reference points to. In this case, when we 
    publish the "mother" file as 
> HTML or FO/PDF, there is naturally an 
    error message in red letters
> saying 
    "<xi:include></xi:include>".
> 
> How can I adjust 
    my customization, so the HTML and FO/PDF output says 
> e.g. 
    "Currently there is no data available" in normal font style instead
> 
    of the original error message?
> 
> Thanks a lot for your 
    support. I could not find any hint that helped me
> out of this 
    problem.
> Martin
> 
> We use: DocBook XML V4.5, XSTLProc, 
    Antenna House V 4.2,
> Docbook-xsl-v1-69-1
> 
> 
    *******************************************
> Harman Becker Automotive 
    Systems GmbH 
> Geschaeftsfuehrung:  Dr. Peter 
    Geiselhart  -  Michael 
    Mauser  -  Edwin Summers  -  Regis 
    Baudot
> Sitz der Gesellschaft: Karlsbad - Registergericht: Mannheim 
    HRB 361395
> 
> ******************************************* 
    
> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte 
    Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
    irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und 
    loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte 
    Weitergabe dieser Mail ist nicht gestattet. 
> This e-mail may contain 
    confidential and/or privileged information. If you are not the intended 
    recipient (or have received this e-mail in error) please notify the sender 
    immediately and delete this e-mail. Any unauthorized copying, disclosure or 
    distribution of the contents in this e-mail is strictly forbidden. 
> 
    *******************************************
> 
> 
    ---------------------------------------------------------------------
> 
    To unsubscribe, e-mail: 
> 
    For additional commands, e-mail: 
> 
    
>
Next in thread → Next in month →