Next in thread → Next in month →

Re: AW: [docbook-apps] Getting a list of XInclude'd files

From
<>
Date
2015-03-20T17:25:33+00:00
ID
Thread
Re: AW: [docbook-apps] Getting a list of XInclude'd files
Yes, thanks Ben. 

Your comment got me further to a solution. I now have a tool that produces 
a listing of all of the xinclude'd  files in a master file. This will list 
out to the screen and make a file (xfilelist.txt) of all the files.

 

I have included the files here for anyone else that might need them.

 

Regards,

Dean Nelson

 

 

 

--------- xfile.xsl ------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    
version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">

 

    <xsl:output method="text" indent="no" 
/>
    <xsl:strip-space elements="*" />

 

    <xsl:template 
match="text()">
    </xsl:template>

 

    <xsl:template match="xi:include" xmlns:xi="http://www.w3.org/2001/XInclude">
        
<xsl:message>
            
<xsl:value-of select="@href" 
/>
        
</xsl:message>
        
<xsl:value-of select="@href" 
/>
        
<xsl:text>
</xsl:text>
        
<xsl:for-each 
select="document(@href)">
            
<xsl:apply-templates />
        
</xsl:for-each>
    </xsl:template>

 

</xsl:stylesheet>

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

 

Here is the Windows batch file that calls it:

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

@REM If you use catalogs...

set XML_CATALOG_FILES=my-catalog.xml

 

@REM Call the xslt processor
xsltproc --nonet -o xfilelist.txt xfile.xsl 
MyBigDocument.xml
-------------------------------

 

 

 

 

In a message dated 3/20/2015 12:36:27 A.M. Pacific Daylight Time, 
 writes:

  

  
Hi 
  Dean,

  
 

  
I 
  think you need to instruct your parser not to resolve the xincludes. I use 
  Xalan with Xerces instead of xsltproc as processor. But in your case, isn’t it 
  sufficient to switch off your –xinclude option before parsing? Then you could 
  easily trace your <include> elements by any suitable 
  template.

  
 

  
best 
  regards,

  
Ben

  
 

  
 

  

  

  
Von: 
   [mailto:] 
Gesendet: Freitag, 
  20. März 2015 07:16
An: 
  
Betreff: [docbook-apps] Getting a 
  list of XInclude'd files

  
 

  

  
All,

  

  
 

  

  
I'm 
  sure this is a pretty common issue? I need to get a list of all of my 
  XIncluded files in a document.

  

  
 

  

  
I 
  need to package up all of the Docbook files required for a 
  particular document so I can send them off to the translators. The document is 
  in a directory with many more Docbook files that are not part of that 
  particular document, so grep'ing would not work well for a 
  list.

  

  
 

  

  
I 
  have tried a few ways but I thought that I would ask on this list to see if 
  any of you have a quick and easy way to process a list. I usually use XSLTPROC 
  or Saxon as a processor (Windows and Linux).

  

  
 

  

  
Any 
  ideas?

  

  
 

  

  
Regards,

  

  
Dean 
  Nelson
Next in thread → Next in month →