Update for DAISY integration ahead of 1.2.0.7.

This commit is contained in:
Gerald Schmidt 2009-12-07 01:38:20 +00:00
parent 08641acec4
commit 635f783128
9 changed files with 308 additions and 131 deletions

View File

@ -10,25 +10,39 @@ bool PlayListRenamer::run (
{ {
std::string m3uFile, m3uBuffer; std::string m3uFile, m3uBuffer;
m3uFile = folder + "playlist.m3u"; m3uFile = folder + "playlist.m3u";
if ( !readFile ( m3uFile, m3uBuffer ) ) if ( !readFile ( m3uFile, m3uBuffer ) )
{
return false; return false;
}
std::vector<std::string> lines; std::vector<std::string> lines;
if ( !splitBuffer ( m3uBuffer, lines ) ) if ( !splitBuffer ( m3uBuffer, lines ) )
{
wxMessageBox ( _T("can't split buffer") );
return false; return false;
}
std::string title, from, to; std::string title, from, to;
size_t lineCount = lines.size(); size_t lineCount = lines.size();
int trackNo = 0; int trackNo = 0;
wxString random;
random.Printf ( _T("%i"), lineCount );
wxMessageBox (random );
for ( size_t i = 0; i < lineCount; i++ ) for ( size_t i = 0; i < lineCount; i++ )
{ {
wxString line;
line = wxString ( lines[i].c_str(), wxConvUTF8, lines[i].size() );
wxMessageBox ( line );
if ( lines[i][0] == '#' ) if ( lines[i][0] == '#' )
{ {
if ( !lines[i].find ( "EXTINF" ) ) if ( lines[i].find ( "EXTINF" ) == std::string::npos )
continue; continue;
//isolate m3u trackname //isolate m3u trackname
std::string pattern0 = ".*?,"; std::string pattern0 = ".+?,";
WrapRegex re0 ( pattern0, true ); WrapRegex re0 ( pattern0, true );
int replacements; int replacements;
title = re0.replaceGlobal ( lines[i], &replacements ); title = re0.replaceGlobal ( lines[i], &replacements );
@ -66,6 +80,10 @@ bool PlayListRenamer::run (
from = lines[i]; from = lines[i];
to = title; to = title;
wxString wideFrom, wideTo;
wideFrom = wxString ( from.c_str(), wxConvUTF8, from.size() );
wideTo = wxString ( to.c_str(), wxConvUTF8, to.size() );
renameFile ( from, to, folder ); renameFile ( from, to, folder );
editFiles ( from, to, folder ); editFiles ( from, to, folder );
@ -88,8 +106,9 @@ bool PlayListRenamer::readFile ( const std::string& path, std::string& buffer )
return true; return true;
} }
bool PlayListRenamer::splitBuffer ( const std::string& buffer, std::vector<std::string> lineVector ) bool PlayListRenamer::splitBuffer ( const std::string& buffer, std::vector<std::string>& lineVector )
{ {
wxMessageBox ( wxString ( buffer.c_str(), wxConvUTF8, buffer.size() ) );
std::string line; std::string line;
lineVector.clear(); lineVector.clear();
size_t bufferSize = buffer.size(); size_t bufferSize = buffer.size();
@ -134,7 +153,8 @@ void PlayListRenamer::renameFile ( const std::string& from, const std::string& t
wideFolder = wxString ( folder.c_str(), wxConvUTF8, folder.size() ); wideFolder = wxString ( folder.c_str(), wxConvUTF8, folder.size() );
wideFrom = wxString ( from.c_str(), wxConvUTF8, from.size() ); wideFrom = wxString ( from.c_str(), wxConvUTF8, from.size() );
wideTo = wxString ( to.c_str(), wxConvUTF8, to.size() ); wideTo = wxString ( to.c_str(), wxConvUTF8, to.size() );
wxRenameFile ( wideFolder + wideFrom, wideFolder + wideTo ); wxMessageBox ( wideFolder + wideFrom, wideFolder + wideTo );
//wxRenameFile ( wideFolder + wideFrom, wideFolder + wideTo );
} }
void PlayListRenamer::editFiles ( const std::string& from, const std::string& to, const std::string& folder ) void PlayListRenamer::editFiles ( const std::string& from, const std::string& to, const std::string& folder )

View File

@ -12,7 +12,7 @@ public:
bool run ( const std::string& folder ); bool run ( const std::string& folder );
private: private:
bool readFile ( const std::string& path, std::string& buffer ); bool readFile ( const std::string& path, std::string& buffer );
bool splitBuffer ( const std::string& buffer, std::vector<std::string> lineVector ); bool splitBuffer ( const std::string& buffer, std::vector<std::string>& lineVector );
void renameFile ( const std::string& from, const std::string& to, const std::string& folder ); void renameFile ( const std::string& from, const std::string& to, const std::string& folder );
void editFiles ( const std::string& from, const std::string& to, const std::string& folder ); void editFiles ( const std::string& from, const std::string& to, const std::string& folder );
std::string numToString ( int i ); std::string numToString ( int i );

View File

@ -11,7 +11,9 @@
#include "xmlcopyimg.h" #include "xmlcopyimg.h"
#include "binaryfile.h" #include "binaryfile.h"
#include "replace.h" #include "replace.h"
#include "wrapregex.h"
#include "mp3album.h" #include "mp3album.h"
//#include "playlistrenamer.h"
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <wx/msw/ole/automtn.h> #include <wx/msw/ole/automtn.h>
@ -195,6 +197,19 @@ bool WrapDaisy::run (
// prevent MIME type errors in href="www..." attributes // prevent MIME type errors in href="www..." attributes
Replace::run ( output, "href=\"www", "href=\"http://www", true ); Replace::run ( output, "href=\"www", "href=\"http://www", true );
// remove em-space
Replace::run ( output, "\xE2\x80\x83", " ", true );
// remove blank paragraphs
Replace::run ( output, "<p></p>", "", true );
int replaceCount;
WrapRegex regexParaWhitespace ( "<p>\\w+</p>", true );
output = regexParaWhitespace.replaceGlobal ( output, &replaceCount );
WrapRegex regexContiguousWhitespace ( "[\\t ]+", true, " " );
output = regexContiguousWhitespace.replaceGlobal ( output, &replaceCount );
// copy images // copy images
wxString htmlDir, imagesDir, mediaDir; wxString htmlDir, imagesDir, mediaDir;
htmlDir = folder + wxFileName::GetPathSeparator() + _T("html"); htmlDir = folder + wxFileName::GetPathSeparator() + _T("html");
@ -245,7 +260,7 @@ bool WrapDaisy::run (
while (wxTheApp->Pending()) while (wxTheApp->Pending())
wxTheApp->Dispatch(); wxTheApp->Dispatch();
if ( !pd->Update ( 25, _("Copying images and audio files...") ) ) if ( !pd->Update ( 25, _("Copying files...") ) )
{ {
error = _ ( "Cancelled" ); error = _ ( "Cancelled" );
return false; return false;
@ -299,7 +314,7 @@ bool WrapDaisy::run (
wxString cmd = baseCmd + wxString cmd = baseCmd +
xhtml2dtbookScript + xhtml2dtbookScript +
_T(" --inputFile=\"") + _T(" --inputFile=\"") +
canonicalFile + //canonicalFile.wideName() + canonicalFile +
_T("\" --outputFile=\"") + _T("\" --outputFile=\"") +
dtbFilePath + _T("\""); dtbFilePath + _T("\"");
@ -328,7 +343,7 @@ bool WrapDaisy::run (
if ( !error.empty() ) if ( !error.empty() )
return false; return false;
// #2.5: create EPUB version // #2.5: create ePub version
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
while (wxTheApp->Pending()) while (wxTheApp->Pending())
wxTheApp->Dispatch(); wxTheApp->Dispatch();
@ -403,7 +418,15 @@ bool WrapDaisy::run (
rtfScript += wxFileName::GetPathSeparator(); rtfScript += wxFileName::GetPathSeparator();
rtfScript += _T("DtbookToRtf.taskScript"); rtfScript += _T("DtbookToRtf.taskScript");
wxString rtfFile = folder + wxFileName::GetPathSeparator() + _T("document.rtf"); wxString rtfFile, tempRtfFile, docFile, tempDocFile;
rtfFile = folder + wxFileName::GetPathSeparator() + _T("document.rtf");
tempRtfFile = folder + wxFileName::GetPathSeparator() + _T("html") +
wxFileName::GetPathSeparator() + _T("document.rtf");
docFile = rtfFile;
tempDocFile = tempRtfFile;
docFile.Replace ( _T(".rtf"), _T(".doc") );
tempDocFile.Replace ( _T(".rtf"), _T(".doc") );
cmd = baseCmd + cmd = baseCmd +
_T("\"") + rtfScript + _T("\" --input=\"") + _T("\"") + rtfScript + _T("\" --input=\"") +
@ -451,9 +474,8 @@ bool WrapDaisy::run (
return false; return false;
} }
//wxString docFile = rtfFile;
wxString docFile = rtfFile; //docFile.Replace ( _T(".rtf"), _T(".doc") );
docFile.Replace ( _T(".rtf"), _T(".doc") );
#ifdef __WXMSW__ #ifdef __WXMSW__
wxAutomationObject wordObject, documentObject; wxAutomationObject wordObject, documentObject;
@ -461,17 +483,17 @@ bool WrapDaisy::run (
if ( wordObject.CreateInstance ( _T("Word.Application") ) ) if ( wordObject.CreateInstance ( _T("Word.Application") ) )
{ {
wxVariant openParams[2]; wxVariant openParams[2];
openParams[0] = rtfFile; openParams[0] = rtfFile;//tempRtfFile
openParams[1] = false; openParams[1] = false;
wordObject.CallMethod(_("documents.open"), 2, openParams); wordObject.CallMethod(_("documents.open"), 2, openParams);
if (!wordObject.GetObject(documentObject, _("ActiveDocument"))) if (!wordObject.GetObject(documentObject, _("ActiveDocument")))
{ {
error = _("Cannot open ") + rtfFile; error = _("Cannot open ") + rtfFile;//tempRtfFile;
return false; return false;
} }
wxVariant saveAsParams[2]; wxVariant saveAsParams[2];
saveAsParams[0] = docFile; saveAsParams[0] = docFile;//tempDocFile;//
saveAsParams[1] = (long)0; //wdFormatDocument saveAsParams[1] = (long)0; //wdFormatDocument
if ( !documentObject.CallMethod(_("SaveAs"), 2, saveAsParams) ) if ( !documentObject.CallMethod(_("SaveAs"), 2, saveAsParams) )
{ {
@ -482,9 +504,15 @@ bool WrapDaisy::run (
wordObject.CallMethod(_T("Quit"), 0, NULL ); wordObject.CallMethod(_T("Quit"), 0, NULL );
} }
#else #else
//wxCopyFile ( tempRtfFile, tempDocFile );
wxCopyFile ( rtfFile, docFile ); wxCopyFile ( rtfFile, docFile );
#endif #endif
//wxCopyFile ( tempRtfFile, rtfFile );
//wxCopyFile ( tempDocFile, docFile );
//wxRemoveFile ( tempRtfFile );
//wxRemoveFile ( tempDocFile );
// #3: convert to full DAISY book // #3: convert to full DAISY book
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
while (wxTheApp->Pending()) while (wxTheApp->Pending())
@ -629,8 +657,9 @@ bool WrapDaisy::run (
return false; return false;
} }
//rename mp3 playlists
/* /*
//rename mp3 playlists
albumDir += wxFileName::GetPathSeparator();
PlayListRenamer plr; PlayListRenamer plr;
std::string stdAlbumDir = ( const char *) albumDir.mb_str ( wxConvUTF8 ); std::string stdAlbumDir = ( const char *) albumDir.mb_str ( wxConvUTF8 );
plr.run ( stdAlbumDir ); plr.run ( stdAlbumDir );

View File

@ -41,7 +41,7 @@
"License along with this program; if not, write to the Free\n"\ "License along with this program; if not, write to the Free\n"\
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\ "Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
"Boston, MA 02111-1307 USA.") "Boston, MA 02111-1307 USA.")
#define ABOUT_VERSION _T("1.2.0.6") #define ABOUT_VERSION _T("1.2.0.7")
#define XMLCE_VAR _T("XMLCE_VAR") #define XMLCE_VAR _T("XMLCE_VAR")
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@ -135,7 +135,7 @@ void XMLCALL XmlCopyImg::start ( void *data,
{ {
wxString cmd; wxString cmd;
cmd += IMAGEMAGICK_CONVERT_PATH; cmd += IMAGEMAGICK_CONVERT_PATH;
cmd += _T(" -resize 720x1440>"); cmd += _T(" -resize 720x720>");
cmd += _T(" \""); cmd += _T(" \"");
cmd += wideFile; cmd += wideFile;
cmd += _T("\" \""); cmd += _T("\" \"");

View File

@ -36,60 +36,107 @@
<xsl:variable name="caps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:variable name="caps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:value-of select="translate(text(), $small, $caps)"/> <xsl:value-of select="translate(text(), $small, $caps)"/>
</xsl:template> </xsl:template>
<xsl:template match="SideNote">
<br/>
<hr/>
<span class="required-prodnote">Side note</span>
<br/>
<xsl:apply-templates/>
<span class="optional-prodnote">End of side note</span>
<hr/>
<br/>
</xsl:template>
<xsl:template match="SideNote/Heading">
<br/>
<em>
<xsl:apply-templates/>
</em>
</xsl:template>
<xsl:template match="SideNoteParagraph">
<br/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Footnote">
<br/>
<hr/>
<span class="required-prodnote">Footnote</span>
<br/>
<xsl:apply-templates/>
<br/>
<hr/>
<span class="optional-prodnote">End of footnote</span>
<br/>
</xsl:template>
<xsl:template match="InlineEquation"> <xsl:template match="InlineEquation">
<br/> <xsl:choose>
<xsl:apply-templates/> <xsl:when test="string-length(./Image/@src) &gt; 0">
</xsl:template>
<xsl:template match="InlineEquation/Image">
<img> <img>
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:value-of select="./Image/@src"/> <xsl:value-of select="./Image/@src"/>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="alt"> <xsl:attribute name="alt">
<xsl:choose>
<xsl:when test="string-length(Description) &gt; 0">
<xsl:value-of select="Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0">
<xsl:value-of select="./Image/@alt"/> <xsl:value-of select="./Image/@alt"/>
</xsl:when>
<xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/>
</xsl:when>
<xsl:when test="string-length(TeX) &gt; 0">
<xsl:value-of select="TeX"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no alternative text</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</img>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./Image/text() | ./Image/* "/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template
match="InlineEquation/Description | InlineEquation/Alternative | InlineEquation/TeX | InlineEquation/MathML"/>
<xsl:template match="InlineFigure">
<img>
<xsl:attribute name="src">
<xsl:value-of select="./Image/@src"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:choose>
<xsl:when test="string-length(Description) &gt; 0">
<xsl:value-of select="Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0">
<xsl:value-of select="./Image/@alt"/>
</xsl:when>
<xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no alternative text</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute> </xsl:attribute>
</img> </img>
</xsl:template> </xsl:template>
<xsl:template match="InlineEquation/Description"> <xsl:template match="InlineFigure/Description | InlineFigure/Alternative"/>
<value-of select="text()"/>
<br/>
<xsl:template match="InlineChemistry">
<xsl:choose>
<xsl:when test="string-length(./Image/@src) &gt; 0">
<img>
<xsl:attribute name="src">
<xsl:value-of select="./Image/@src"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:choose>
<xsl:when test="string-length(Description) &gt; 0">
<xsl:value-of select="Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0">
<xsl:value-of select="./Image/@alt"/>
</xsl:when>
<xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no alternative text</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</img>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./Image/text() | ./Image/* "/>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="InlineEquation/Alternative"> <xsl:template
<value-of select="text()"/> match="InlineChemistry/Description | InlineChemistry/Alternative"/>
<br/>
</xsl:template>
<xsl:template match="InlineEquation/TeX | InlineEquation/MathML"/>
<xsl:template match="AuthorComment"> <xsl:template match="AuthorComment">
<!-- omit --> <!-- omit -->
<xsl:apply-templates/> <xsl:apply-templates/>

View File

@ -1,12 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template name="apply-templates-lang"> <xsl:template name="apply-templates-lang">
<xsl:param name="filter-sidenotes" select="'true'"/>
<xsl:for-each select="@xml:lang"> <xsl:for-each select="@xml:lang">
<xsl:if test="string-length(.) &gt; 0"> <xsl:if test="string-length(.) &gt; 0">
<xsl:copy/> <xsl:copy/>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
<xsl:choose>
<xsl:when test="$filter-sidenotes = 'true'">
<xsl:apply-templates select="node()[not(self::SideNote)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="language"> <xsl:template match="language">
<xsl:if test="string-length(@val) &gt; 0"> <xsl:if test="string-length(@val) &gt; 0">

View File

@ -19,8 +19,8 @@
<xsl:template match="GlossaryItem"> <xsl:template match="GlossaryItem">
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</xsl:template> </xsl:template>
<xsl:template match="GlossaryItem/Term"><p><em><xsl:call-template name="apply-templates-lang"/></em></p>  <xsl:template match="GlossaryItem/Term"><p><em><xsl:call-template name="apply-templates-lang"
</xsl:template> /></em></p>  </xsl:template>
<xsl:template match="GlossaryItem/Definition"> <xsl:template match="GlossaryItem/Definition">
<p> <p>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
@ -105,6 +105,7 @@
</p> </p>
<xsl:choose> <xsl:choose>
<xsl:when test="string-length(./Image/@src) &gt; 0"> <xsl:when test="string-length(./Image/@src) &gt; 0">
<p>
<img> <img>
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:value-of select="./Image/@src"/> <xsl:value-of select="./Image/@src"/>
@ -123,6 +124,7 @@
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
</img> </img>
</p>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<p> <p>
@ -143,6 +145,7 @@
</p> </p>
<xsl:choose> <xsl:choose>
<xsl:when test="string-length(./Image/@src) &gt; 0"> <xsl:when test="string-length(./Image/@src) &gt; 0">
<p>
<img> <img>
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:value-of select="./Image/@src"/> <xsl:value-of select="./Image/@src"/>
@ -161,6 +164,7 @@
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
</img> </img>
</p>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<p> <p>
@ -396,4 +400,17 @@
<span class="optional-prodnote">End of summary</span> <span class="optional-prodnote">End of summary</span>
</p> </p>
</xsl:template> </xsl:template>
<xsl:template match="SideNote">
<hr/>
<span class="optional-prodnote">Side note</span>
<xsl:apply-templates/>
<span class="optional-prodnote">End of side note</span>
<hr/>
</xsl:template>
<xsl:template match="footnote">
<sup>
<xsl:value-of select="count(preceding::footnote) + 1"/>
</sup>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="Paragraph"> <xsl:template match="Paragraph">
<xsl:call-template name="handle-sidenotes"/>
<p> <p>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</p> </p>
<xsl:call-template name="handle-footnotes"/>
</xsl:template> </xsl:template>
<xsl:template match="Unit"> <xsl:template match="Unit">
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
@ -16,6 +18,11 @@
</h1> </h1>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="SideNoteParagraph">
<p>
<xsl:call-template name="apply-templates-lang"/>
</p>
</xsl:template>
<xsl:template match="Unit/ByLine"> <xsl:template match="Unit/ByLine">
<p> <p>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
@ -126,25 +133,52 @@
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</xsl:template> </xsl:template>
<xsl:template match="MediaContent"> <xsl:template match="MediaContent">
<xsl:if test="@type = 'audio'"> <xsl:choose>
<xsl:when test="@type = 'audio'">
<p> <p>
<span class="required-prodnote">[Audio content]</span> <span class="required-prodnote">Audio content</span>
</p> </p>
<p> <p>
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp3</xsl:attribute>MP3 file <a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp3</xsl:attribute>MP3 file
</a> </a>
</p> </p>
</xsl:if> </xsl:when>
<xsl:if test="@type = 'pdf'"> <xsl:when test="@type = 'java'">
<p> <p>
<span class="required-prodnote">[PDF content]</span> <span class="required-prodnote">Java content</span>
</p> </p>
<p>
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.jar</xsl:attribute>Java
file</a>
</p>
</xsl:when>
<xsl:when test="@type = 'flash'">
<p>
<span class="required-prodnote">Flash content</span>
</p>
<p>
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.swf</xsl:attribute>Flash file
</a>
</p>
</xsl:when>
<xsl:when test="@type = 'video' or @type = 'videolow'">
<p>
<span class="required-prodnote">Movie content</span>
</p>
<p>
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp4</xsl:attribute>Flash file
</a>
</p>
</xsl:when>
<xsl:when test="@type = 'pdf'">
<p>
<span class="required-prodnote">PDF content</span>
</p>
<!-- not possible in DAISY or ePub ATM -->
<!--<p><a><xsl:attribute name="href"><xsl:value-of select="@src"/>.pdf</xsl:attribute></a></p>--> <!--<p><a><xsl:attribute name="href"><xsl:value-of select="@src"/>.pdf</xsl:attribute></a></p>-->
</xsl:if> </xsl:when>
</xsl:choose>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
<p>
<span class="optional-prodnote">End of <xsl:value-of select="@type"/> content</span>
</p>
</xsl:template> </xsl:template>
<xsl:template match="a"> <xsl:template match="a">
<a href="{@href}"> <a href="{@href}">
@ -156,7 +190,8 @@
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</ol> </ol>
</xsl:template> </xsl:template>
<xsl:template match="BulletedList | UnNumberedList | BulletedSubsidiaryList | UnNumberedSubsidiaryList"> <xsl:template
match="BulletedList | UnNumberedList | BulletedSubsidiaryList | UnNumberedSubsidiaryList">
<ul> <ul>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</ul> </ul>
@ -176,18 +211,18 @@
<xsl:template match="Alternative"> <xsl:template match="Alternative">
<p> <p>
<xsl:if test="string-length(.) &gt; 0"> <xsl:if test="string-length(.) &gt; 0">
<span class="optional-prodnote"><strong>Alternative</strong>: </span> <span class="optional-prodnote"><strong>Alternative text</strong>: </span>
</xsl:if> </xsl:if>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</p> </p>
</xsl:template> </xsl:template>
<xsl:template match="Description"> <xsl:template match="Description">
<p>
<xsl:if test="string-length(.) &gt; 0"> <xsl:if test="string-length(.) &gt; 0">
<span class="optional-prodnote"><strong>Description</strong>: </span> <p>
</xsl:if> <span class="required-prodnote"><strong>Description</strong></span>: <xsl:call-template
<xsl:call-template name="apply-templates-lang"/> name="apply-templates-lang"/>
</p> </p>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="Label"> <xsl:template match="Label">
<p> <p>
@ -246,14 +281,35 @@
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</p> </p>
</xsl:template> </xsl:template>
<xsl:template match="Timing/Hours"><br/><xsl:call-template name="apply-templates-lang"/> hours<br/> <xsl:template match="Timing/Hours"><br/><xsl:call-template name="apply-templates-lang"/>
</xsl:template> hours<br/>
<xsl:template match="Timing/Minutes"><br/><xsl:call-template name="apply-templates-lang"/> minutes<br/> </xsl:template>
</xsl:template> <xsl:template match="Timing/Minutes"><br/><xsl:call-template name="apply-templates-lang"/>
minutes<br/>
</xsl:template>
<xsl:template match="Quote"> <xsl:template match="Quote">
<blockquote> <blockquote>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</blockquote> </blockquote>
</xsl:template> </xsl:template>
<xsl:template match="Imprint"/> <xsl:template match="Imprint"/>
<xsl:template name="handle-sidenotes">
<xsl:if test="count(./SideNote) &gt; 0">
<hr/>
<xsl:for-each select="./SideNote">
<xsl:call-template name="apply-templates-lang">
<xsl:with-param name="filter-sidenotes">false</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<hr/>
</xsl:if>
</xsl:template>
<xsl:template name="handle-footnotes">
<xsl:if test="count(./footnote) &gt; 0">
<xsl:for-each select="./footnote">
<p><strong>Footnote <xsl:value-of select="count(preceding::footnote) + 1"/></strong>:
<xsl:apply-templates select="text()|./*"/></p>
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>