updated for v. 1.0.3

This commit is contained in:
Gerald Schmidt 2010-04-25 22:24:53 +00:00
parent 635f783128
commit 68b60043a3
9 changed files with 272 additions and 200 deletions

View File

@ -165,6 +165,12 @@ void ExportDialog::OnOk ( wxCommandEvent& e )
folder = dirPicker->GetPath(); folder = dirPicker->GetPath();
quiet = quietCheckbox->IsChecked(); quiet = quietCheckbox->IsChecked();
mp3Album = mp3AlbumCheckbox->IsChecked(); mp3Album = mp3AlbumCheckbox->IsChecked();
suppressOptional = suppressOptionalCheckbox->IsChecked();
html = htmlCheckbox->IsChecked();
epub = epubCheckbox->IsChecked();
rtf = rtfCheckbox->IsChecked();
doc = docCheckbox->IsChecked();
fullDaisy = fullDaisyCheckbox->IsChecked();
urlUtf8 = ( const char * ) url.mb_str ( wxConvUTF8 ); urlUtf8 = ( const char * ) url.mb_str ( wxConvUTF8 );
e.Skip(); e.Skip();
@ -199,13 +205,6 @@ void ExportDialog::OnContextHelp ( wxHelpEvent& e )
void ExportDialog::OnUpdateOk ( wxUpdateUIEvent& e ) void ExportDialog::OnUpdateOk ( wxUpdateUIEvent& e )
{ {
bool enable = true; bool enable = true;
/*
#ifdef __WXMSW__
if ( urlCtrl->GetTextCtrlValue().empty() ||
#else
if ( urlCtrl->GetPath().empty() ||
#endif
*/
if ( if (
dirPicker->GetPath().empty() || dirPicker->GetPath().empty() ||
downloadLink ) downloadLink )
@ -233,6 +232,13 @@ bool ExportDialog::getMp3Album()
return mp3Album; return mp3Album;
} }
bool ExportDialog::getSuppressOptional() { return suppressOptional; }
bool ExportDialog::getHtml() { return html; }
bool ExportDialog::getEpub() { return epub; }
bool ExportDialog::getRtf() { return rtf; }
bool ExportDialog::getDoc() { return doc; }
bool ExportDialog::getFullDaisy() { return fullDaisy; }
void ExportDialog::OnFolderBrowse ( wxCommandEvent& e ) void ExportDialog::OnFolderBrowse ( wxCommandEvent& e )
{ {
} }

View File

@ -49,6 +49,13 @@ class ExportDialog : public wxDialog
wxString getFolderString(); wxString getFolderString();
bool getQuiet(); bool getQuiet();
bool getMp3Album(); bool getMp3Album();
bool getSuppressOptional();
bool getHtml();
bool getEpub();
bool getRtf();
bool getDoc();
bool getFullDaisy();
enum constants enum constants
{ {
ID_URL, ID_URL,

View File

@ -66,6 +66,7 @@ bool WrapDaisy::run (
bool suppressOptional, bool suppressOptional,
bool epub, bool epub,
bool rtf, bool rtf,
bool doc,
bool fullDaisy, bool fullDaisy,
bool mp3Album ) bool mp3Album )
{ {
@ -348,176 +349,185 @@ bool WrapDaisy::run (
while (wxTheApp->Pending()) while (wxTheApp->Pending())
wxTheApp->Dispatch(); wxTheApp->Dispatch();
if ( !pd->Update ( 50, _T("Preparing ePub...") ) ) if ( epub )
{ {
error = _T ( "Cancelled" ); if ( !pd->Update ( 50, _T("Preparing ePub...") ) )
return false; {
} error = _T ( "Cancelled" );
return false;
wxString epubScript; }
epubScript += _T("scripts"); wxString epubScript;
epubScript += wxFileName::GetPathSeparator();
epubScript += _T("create_distribute");
epubScript += wxFileName::GetPathSeparator();
epubScript += _T("epub");
epubScript += wxFileName::GetPathSeparator();
epubScript += _T("OPSCreator.taskScript");
cmd = baseCmd +
_T("\"") + epubScript + _T("\" --input=\"") +
canonicalFile + //canonicalFile.wideName() +
_T("\" --output=\"") +
folder + wxFileName::GetPathSeparator() + _T("ebook.epub\"");
result = wxExecute ( cmd, out, err ); epubScript += _T("scripts");
epubScript += wxFileName::GetPathSeparator();
count = err.GetCount(); epubScript += _T("create_distribute");
if ( count ) epubScript += wxFileName::GetPathSeparator();
{ epubScript += _T("epub");
for ( int i = 0; i < count; i++ ) epubScript += wxFileName::GetPathSeparator();
{ epubScript += _T("OPSCreator.taskScript");
error += err.Item ( i );
error += _T(" ");
}
}
/* cmd = baseCmd +
count = out.GetCount(); _T("\"") + epubScript + _T("\" --input=\"") +
if ( count ) canonicalFile + //canonicalFile.wideName() +
{ _T("\" --output=\"") +
for ( int i = 0; i < count; i++ ) folder + wxFileName::GetPathSeparator() + _T("ebook.epub\"");
result = wxExecute ( cmd, out, err );
count = err.GetCount();
if ( count )
{ {
error += out.Item ( i ); for ( int i = 0; i < count; i++ )
error += _T(" "); {
error += err.Item ( i );
error += _T(" ");
}
} }
/*
count = out.GetCount();
if ( count )
{
for ( int i = 0; i < count; i++ )
{
error += out.Item ( i );
error += _T(" ");
}
}
*/
if ( !error.empty() )
return false;
} }
*/
if ( !error.empty() )
return false;
// #2.9: convert to RTF // #2.9: convert to RTF
pd->ProcessPendingEvents(); if ( rtf || doc )
while (wxTheApp->Pending())
wxTheApp->Dispatch();
if ( !pd->Update ( 60, _T("Preparing RTF...") ) )
{ {
error = _T ( "Cancelled" ); pd->ProcessPendingEvents();
return false; while (wxTheApp->Pending())
} wxTheApp->Dispatch();
wxString rtfScript;
rtfScript += _T("scripts"); if ( !pd->Update ( 60, _T("Preparing RTF...") ) )
rtfScript += wxFileName::GetPathSeparator(); {
rtfScript += _T("create_distribute"); error = _T ( "Cancelled" );
rtfScript += wxFileName::GetPathSeparator(); return false;
rtfScript += _T("text"); }
rtfScript += wxFileName::GetPathSeparator();
rtfScript += _T("DtbookToRtf.taskScript");
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 + wxString rtfScript;
_T("\"") + rtfScript + _T("\" --input=\"") +
dtbFilePath + //dtbFile.wideName() +
_T("\" --output=\"") + rtfFile +
_T("\" --inclTOC=\"true\" --inclPagenum=\"false\"");
result = wxExecute ( cmd, out, err ); rtfScript += _T("scripts");
rtfScript += wxFileName::GetPathSeparator();
count = err.GetCount(); rtfScript += _T("create_distribute");
if ( count ) rtfScript += wxFileName::GetPathSeparator();
{ rtfScript += _T("text");
for ( int i = 0; i < count; i++ ) rtfScript += wxFileName::GetPathSeparator();
rtfScript += _T("DtbookToRtf.taskScript");
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 +
_T("\"") + rtfScript + _T("\" --input=\"") +
dtbFilePath + //dtbFile.wideName() +
_T("\" --output=\"") + rtfFile +
_T("\" --inclTOC=\"true\" --inclPagenum=\"false\"");
result = wxExecute ( cmd, out, err );
count = err.GetCount();
if ( count )
{ {
error += err.Item ( i ); for ( int i = 0; i < count; i++ )
error += _T(" "); {
error += err.Item ( i );
error += _T(" ");
}
} }
/*
count = out.GetCount();
if ( count )
{
for ( int i = 0; i < count; i++ )
{
error += out.Item ( i );
error += _T(" ");
}
}
*/
if ( !error.empty() )
return false;
// #2.9.5: convert to binary Word
// (Win only; otherwise create copy with *.doc extension)
pd->ProcessPendingEvents();
while (wxTheApp->Pending())
wxTheApp->Dispatch();
if ( !pd->Update ( 60, _T("Preparing Word document...") ) )
{
error = _T ( "Cancelled" );
return false;
}
//wxString docFile = rtfFile;
//docFile.Replace ( _T(".rtf"), _T(".doc") );
#ifdef __WXMSW__
wxAutomationObject wordObject, documentObject;
if ( wordObject.CreateInstance ( _T("Word.Application") ) )
{
wxVariant openParams[2];
openParams[0] = rtfFile;//tempRtfFile
openParams[1] = false;
wordObject.CallMethod(_("documents.open"), 2, openParams);
if (!wordObject.GetObject(documentObject, _("ActiveDocument")))
{
error = _("Cannot open ") + rtfFile;//tempRtfFile;
return false;
}
wxVariant saveAsParams[2];
saveAsParams[0] = docFile;//tempDocFile;//
saveAsParams[1] = (long)0; //wdFormatDocument
if ( !documentObject.CallMethod(_("SaveAs"), 2, saveAsParams) )
{
//error = _("Cannot save ") + docFile;
//return false;
}
documentObject.CallMethod(_("Close"), 0, NULL );
wordObject.CallMethod(_T("Quit"), 0, NULL );
}
#else
//wxCopyFile ( tempRtfFile, tempDocFile );
wxCopyFile ( rtfFile, docFile );
#endif
//wxCopyFile ( tempRtfFile, rtfFile );
//wxCopyFile ( tempDocFile, docFile );
//wxRemoveFile ( tempRtfFile );
//wxRemoveFile ( tempDocFile );
} }
/*
count = out.GetCount();
if ( count )
{
for ( int i = 0; i < count; i++ )
{
error += out.Item ( i );
error += _T(" ");
}
}
*/
if ( !error.empty() )
return false;
// #2.9.5: convert to binary Word
// (Win only; otherwise create copy with *.doc extension)
pd->ProcessPendingEvents();
while (wxTheApp->Pending())
wxTheApp->Dispatch();
if ( !pd->Update ( 60, _T("Preparing Word document...") ) )
{
error = _T ( "Cancelled" );
return false;
}
//wxString docFile = rtfFile;
//docFile.Replace ( _T(".rtf"), _T(".doc") );
#ifdef __WXMSW__
wxAutomationObject wordObject, documentObject;
if ( wordObject.CreateInstance ( _T("Word.Application") ) )
{
wxVariant openParams[2];
openParams[0] = rtfFile;//tempRtfFile
openParams[1] = false;
wordObject.CallMethod(_("documents.open"), 2, openParams);
if (!wordObject.GetObject(documentObject, _("ActiveDocument")))
{
error = _("Cannot open ") + rtfFile;//tempRtfFile;
return false;
}
wxVariant saveAsParams[2];
saveAsParams[0] = docFile;//tempDocFile;//
saveAsParams[1] = (long)0; //wdFormatDocument
if ( !documentObject.CallMethod(_("SaveAs"), 2, saveAsParams) )
{
//error = _("Cannot save ") + docFile;
//return false;
}
documentObject.CallMethod(_("Close"), 0, NULL );
wordObject.CallMethod(_T("Quit"), 0, NULL );
}
#else
//wxCopyFile ( tempRtfFile, tempDocFile );
wxCopyFile ( rtfFile, docFile );
#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())
wxTheApp->Dispatch(); wxTheApp->Dispatch();
if ( !fullDaisy )
return true; // no full DAISY, no audio
if ( !pd->Update ( 70, _T("Preparing DAISY books...") ) ) if ( !pd->Update ( 70, _T("Preparing DAISY books...") ) )
{ {
error = _T ( "Cancelled" ); error = _T ( "Cancelled" );
@ -569,6 +579,9 @@ bool WrapDaisy::run (
if ( !error.empty() ) if ( !error.empty() )
return false; return false;
if ( !mp3Album )
return true;
// #4: create MP3 album // #4: create MP3 album
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
while (wxTheApp->Pending()) while (wxTheApp->Pending())
@ -651,19 +664,19 @@ bool WrapDaisy::run (
while (wxTheApp->Pending()) while (wxTheApp->Pending())
wxTheApp->Dispatch(); wxTheApp->Dispatch();
/*
if ( !pd->Update ( 90, _T("Updating playlists...") ) ) if ( !pd->Update ( 90, _T("Updating playlists...") ) )
{ {
error = _T ( "Cancelled" ); error = _T ( "Cancelled" );
return false; return false;
} }
/*
//rename mp3 playlists //rename mp3 playlists
albumDir += wxFileName::GetPathSeparator(); //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 );
*/
//rename mp3 files in //z3986/ //rename mp3 files in //z3986/
wxFileName fn ( dtbFilePath ); wxFileName fn ( dtbFilePath );
@ -741,6 +754,7 @@ bool WrapDaisy::run (
wxFileName::GetPathSeparator() + wxFileName::GetPathSeparator() +
_T("cover.jpg"); _T("cover.jpg");
wxCopyFile ( albumCover, destAlbumCover, true ); wxCopyFile ( albumCover, destAlbumCover, true );
*/
return true; return true;
} }

View File

@ -20,6 +20,7 @@ public:
bool suppressOptional, bool suppressOptional,
bool epub, bool epub,
bool rtf, bool rtf,
bool doc,
bool fullDaisy, bool fullDaisy,
bool mp3Album ); bool mp3Album );
wxString getLastError(); wxString getLastError();

View File

@ -617,12 +617,23 @@ MyFrame::MyFrame (
lastXslStylesheet.Replace ( _T ( " " ), _T ( "%20" ), true ); lastXslStylesheet.Replace ( _T ( " " ), _T ( "%20" ), true );
lastRelaxNGSchema.Replace ( _T ( " " ), _T ( "%20" ), true ); lastRelaxNGSchema.Replace ( _T ( " " ), _T ( "%20" ), true );
exportQuiet = exportQuiet =
config->Read ( _T ( "exportQuiet" ), (long)false ); config->Read ( _T ( "exportQuiet" ), (long)true );
exportMp3Album = exportMp3Album =
config->Read ( _T ( "exportMp3Album" ), (long)false ); config->Read ( _T ( "exportMp3Album" ), (long)true );
exportSuppressOptional =
config->Read ( _T ( "exportSuppressOptional" ), (long)true );
exportHtml =
config->Read ( _T ( "exportHtml" ), (long)true );
exportEpub =
config->Read ( _T ( "exportEpub" ), (long)true );
exportRtf =
config->Read ( _T ( "exportRtf" ), (long)true );
exportDoc =
config->Read ( _T ( "exportDoc" ), (long)true );
exportFullDaisy =
config->Read ( _T ( "exportFullDaisy" ), (long)true );
applicationDir = applicationDir =
config->Read ( _T ( "applicationDir" ), wxEmptyString ); config->Read ( _T ( "applicationDir" ), wxEmptyString );
@ -751,7 +762,8 @@ MyFrame::MyFrame (
exportStylesheet = exportFolder = wxEmptyString; exportStylesheet = exportFolder = wxEmptyString;
exportQuiet = exportMp3Album = false; exportQuiet = exportMp3Album = false;
exportQuiet = exportMp3Album = exportSuppressOptional = exportHtml =
exportEpub = exportRtf = exportDoc = exportFullDaisy = true;
} }
largeFileProperties.completion = false; largeFileProperties.completion = false;
@ -1020,6 +1032,12 @@ MyFrame::~MyFrame()
config->Write ( _T ( "exportFolder" ), exportFolder ); config->Write ( _T ( "exportFolder" ), exportFolder );
config->Write ( _T ( "exportQuiet" ), exportQuiet ); config->Write ( _T ( "exportQuiet" ), exportQuiet );
config->Write ( _T ( "exportMp3Album" ), exportMp3Album ); config->Write ( _T ( "exportMp3Album" ), exportMp3Album );
config->Write ( _T ( "exportSuppressOptional" ), exportSuppressOptional );
config->Write ( _T ( "exportHtml" ), exportHtml );
config->Write ( _T ( "exportEpub" ), exportEpub );
config->Write ( _T ( "exportRtf" ), exportRtf );
config->Write ( _T ( "exportDoc" ), exportDoc );
config->Write ( _T ( "exportFullDaisy" ), exportFullDaisy );
GetPosition ( &framePosX, &framePosY ); GetPosition ( &framePosX, &framePosY );
config->Write ( _T ( "framePosX" ), framePosX ); config->Write ( _T ( "framePosX" ), framePosX );
@ -2067,12 +2085,12 @@ void MyFrame::OnExport ( wxCommandEvent& event )
exportStylesheet, exportStylesheet,
exportFolder, exportFolder,
exportQuiet, exportQuiet,
true, //suppressOptional exportSuppressOptional,
true, //html exportHtml,
true, //epub exportEpub,
true, //rtf exportRtf,
true, //doc exportDoc,
true, //fullDaisy exportFullDaisy,
exportMp3Album, exportMp3Album,
downloadLink ) ); downloadLink ) );
int ret = ed->ShowModal(); int ret = ed->ShowModal();
@ -2084,6 +2102,12 @@ void MyFrame::OnExport ( wxCommandEvent& event )
exportFolder = ed->getFolderString(); exportFolder = ed->getFolderString();
exportQuiet = ed->getQuiet(); exportQuiet = ed->getQuiet();
exportMp3Album = ed->getMp3Album(); exportMp3Album = ed->getMp3Album();
exportSuppressOptional = ed->getSuppressOptional();
exportHtml = ed->getHtml();
exportEpub = ed->getEpub();
exportRtf = ed->getRtf();
exportDoc = ed->getDoc();
exportFullDaisy = ed->getFullDaisy();
std::string rawBufferUtf8; std::string rawBufferUtf8;
getRawText ( doc, rawBufferUtf8 ); getRawText ( doc, rawBufferUtf8 );
@ -2104,7 +2128,17 @@ void MyFrame::OnExport ( wxCommandEvent& event )
wxString tempFile= tempFileName.wideName(); wxString tempFile= tempFileName.wideName();
WrapDaisy wd ( this, daisyDir, doc->getFullFileName() ); WrapDaisy wd ( this, daisyDir, doc->getFullFileName() );
if ( !wd.run ( tempFile, exportStylesheet, exportFolder, exportQuiet, exportMp3Album, true, true, true, true ) ) if ( !wd.run (
tempFile,
exportStylesheet,
exportFolder,
exportQuiet,
exportSuppressOptional,
exportEpub,
exportRtf,
exportDoc,
exportFullDaisy,
exportMp3Album ) )
{ {
messagePane ( _ ("[b]DAISY export stopped[/b]: ") + wd.getLastError(), CONST_STOP ); messagePane ( _ ("[b]DAISY export stopped[/b]: ") + wd.getLastError(), CONST_STOP );
return; return;

View File

@ -444,7 +444,13 @@ class MyFrame : public wxFrame
findRegex, findRegex,
commandSync, commandSync,
exportQuiet, exportQuiet,
exportMp3Album; exportMp3Album,
exportSuppressOptional,
exportHtml,
exportEpub,
exportRtf,
exportDoc,
exportFullDaisy;
wxBitmap newBitmap, wxBitmap newBitmap,
new16Bitmap, new16Bitmap,
openBitmap, openBitmap,

View File

@ -51,11 +51,11 @@
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</h3> </h3>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<h2> <h2>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
</h2> </h2>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="SubSubHeading"> <xsl:template match="SubSubHeading">
@ -66,9 +66,7 @@
<xsl:template match="Question"> <xsl:template match="Question">
<xsl:if test="count(Heading) = '0'"> <xsl:if test="count(Heading) = '0'">
<p> <p>
<span class="optional-prodnote"> <span class="optional-prodnote">Question</span>
<strong>Question</strong>
</span>
</p> </p>
</xsl:if> </xsl:if>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
@ -76,9 +74,7 @@
<xsl:template match="Answer"> <xsl:template match="Answer">
<xsl:if test="count(Heading) = '0'"> <xsl:if test="count(Heading) = '0'">
<p> <p>
<span class="optional-prodnote"> <span class="optional-prodnote">Answer</span>
<strong>Answer</strong>
</span>
</p> </p>
</xsl:if> </xsl:if>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>
@ -86,9 +82,7 @@
<xsl:template match="Discussion"> <xsl:template match="Discussion">
<xsl:if test="count(Heading) = '0'"> <xsl:if test="count(Heading) = '0'">
<p> <p>
<span class="optional-prodnote"> <span class="optional-prodnote">Discussion</span>
<strong>Discussion</strong>
</span>
</p> </p>
</xsl:if> </xsl:if>
<xsl:call-template name="apply-templates-lang"/> <xsl:call-template name="apply-templates-lang"/>

View File

@ -129,14 +129,6 @@
</xsl:template> </xsl:template>
<xsl:template <xsl:template
match="InlineChemistry/Description | InlineChemistry/Alternative"/> match="InlineChemistry/Description | InlineChemistry/Alternative"/>
<xsl:template match="AuthorComment"> <xsl:template match="AuthorComment">
<!-- omit --> <!-- omit -->
<xsl:apply-templates/> <xsl:apply-templates/>

View File

@ -112,12 +112,19 @@
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="alt"> <xsl:attribute name="alt">
<xsl:choose> <xsl:choose>
<xsl:when
test="count(./Description/*) = 0 and string-length(./Description) &lt; 1024">
<xsl:value-of select="./Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0"> <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>
<xsl:when test="string-length(Alternative) &gt; 0"> <xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/> <xsl:value-of select="Alternative"/>
</xsl:when> </xsl:when>
<xsl:when test="count(./Description/*) &gt; 0">
<xsl:text>figure description follows</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>no alternative text</xsl:text> <xsl:text>no alternative text</xsl:text>
</xsl:otherwise> </xsl:otherwise>
@ -133,7 +140,9 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:apply-templates select="Caption"/> <xsl:apply-templates select="Caption"/>
<xsl:apply-templates select="Description"/> <xsl:if test="count(./Description/*) &gt; 0 or string-length(./Description) &gt; 1024">
<xsl:apply-templates select="Description"/>
</xsl:if>
<xsl:apply-templates select="SourceReference"/> <xsl:apply-templates select="SourceReference"/>
<p> <p>
<span class="optional-prodnote">End of figure</span> <span class="optional-prodnote">End of figure</span>
@ -152,12 +161,19 @@
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="alt"> <xsl:attribute name="alt">
<xsl:choose> <xsl:choose>
<xsl:when
test="count(./Description/*) = 0 and string-length(./Description) &lt; 1024">
<xsl:value-of select="./Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0"> <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>
<xsl:when test="string-length(Alternative) &gt; 0"> <xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/> <xsl:value-of select="Alternative"/>
</xsl:when> </xsl:when>
<xsl:when test="count(./Description/*) &gt; 0">
<xsl:text>equation description follows</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>no alternative text</xsl:text> <xsl:text>no alternative text</xsl:text>
</xsl:otherwise> </xsl:otherwise>
@ -176,7 +192,9 @@
<xsl:apply-templates select="TeX"/> <xsl:apply-templates select="TeX"/>
<xsl:apply-templates select="MathML"/> <xsl:apply-templates select="MathML"/>
<xsl:apply-templates select="Caption"/> <xsl:apply-templates select="Caption"/>
<xsl:apply-templates select="Description"/> <xsl:if test="count(./Description/*) &gt; 0 or string-length(./Description) &gt; 1024">
<xsl:apply-templates select="Description"/>
</xsl:if>
<xsl:apply-templates select="SourceReference"/> <xsl:apply-templates select="SourceReference"/>
<span class="optional-prodnote">End of equation</span> <span class="optional-prodnote">End of equation</span>
</xsl:template> </xsl:template>
@ -402,9 +420,9 @@
</xsl:template> </xsl:template>
<xsl:template match="SideNote"> <xsl:template match="SideNote">
<hr/> <hr/>
<span class="optional-prodnote">Side note</span> <p><span class="optional-prodnote">Side note</span></p>
<xsl:apply-templates/> <xsl:apply-templates/>
<span class="optional-prodnote">End of side note</span> <p><span class="optional-prodnote">End of side note</span></p>
<hr/> <hr/>
</xsl:template> </xsl:template>
<xsl:template match="footnote"> <xsl:template match="footnote">