CWS-TOOLING: integrate CWS jl158
This commit is contained in:
@@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
|
||||
::rtl::Reference<AbortChannel> const & abortChannel,
|
||||
Reference<XCommandEnvironment> const & xCmdEnv );
|
||||
|
||||
bool extensionContainsCompiledHelp();
|
||||
public:
|
||||
PackageImpl(
|
||||
::rtl::Reference<PackageRegistryBackend> const & myBackend,
|
||||
@@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
|
||||
Reference<XCommandEnvironment> const & xCmdEnv );
|
||||
|
||||
void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
|
||||
Reference<ucb::XCommandEnvironment> const & xCmdEnv);
|
||||
bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv);
|
||||
void implCollectXhpFiles( const rtl::OUString& aDir,
|
||||
std::vector< rtl::OUString >& o_rXhpFileVector );
|
||||
|
||||
@@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const
|
||||
return pBackend;
|
||||
}
|
||||
|
||||
|
||||
bool BackendImpl::PackageImpl::extensionContainsCompiledHelp()
|
||||
{
|
||||
bool bCompiled = true;
|
||||
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL());
|
||||
|
||||
::osl::Directory helpFolder(aExpandedHelpURL);
|
||||
if ( helpFolder.open() == ::osl::File::E_None)
|
||||
{
|
||||
//iterate over the contents of the help folder
|
||||
//We assume that all folders withing the help folder contain language specific
|
||||
//help files. If just one of them does not contain compiled help then this
|
||||
//function returns false.
|
||||
::osl::DirectoryItem item;
|
||||
::osl::File::RC errorNext = ::osl::File::E_None;
|
||||
while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None)
|
||||
{
|
||||
//No find the language folders
|
||||
::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL);
|
||||
if (item.getFileStatus(stat) == ::osl::File::E_None)
|
||||
{
|
||||
if (stat.getFileType() != ::osl::FileStatus::Directory)
|
||||
continue;
|
||||
|
||||
//look if there is the folder help.idxl in the language folder
|
||||
OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl"));
|
||||
::osl::Directory compiledFolder(compUrl);
|
||||
if (compiledFolder.open() != ::osl::File::E_None)
|
||||
{
|
||||
bCompiled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Error
|
||||
OSL_ASSERT(0);
|
||||
bCompiled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errorNext != ::osl::File::E_NOENT
|
||||
&& errorNext != ::osl::File::E_None)
|
||||
{
|
||||
//Error
|
||||
OSL_ASSERT(0);
|
||||
bCompiled = false;
|
||||
}
|
||||
}
|
||||
return bCompiled;
|
||||
}
|
||||
//______________________________________________________________________________
|
||||
beans::Optional< beans::Ambiguous<sal_Bool> >
|
||||
BackendImpl::PackageImpl::isRegistered_(
|
||||
@@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_(
|
||||
|
||||
BackendImpl* that = getMyBackend();
|
||||
Reference< deployment::XPackage > xThisPackage( this );
|
||||
that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv);
|
||||
that->implProcessHelp( xThisPackage, doRegisterPackage,
|
||||
extensionContainsCompiledHelp(), xCmdEnv);
|
||||
}
|
||||
|
||||
beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL()
|
||||
@@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) );
|
||||
|
||||
|
||||
void BackendImpl::implProcessHelp
|
||||
( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
|
||||
( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp,
|
||||
Reference<ucb::XCommandEnvironment> const & xCmdEnv)
|
||||
{
|
||||
OSL_ASSERT(xPackage.is());
|
||||
if (doRegisterPackage)
|
||||
{
|
||||
HelpBackendDb::Data data;
|
||||
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
|
||||
data.dataUrl = sHelpFolder;
|
||||
|
||||
Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
|
||||
rtl::OUString aHelpURL = xPackage->getURL();
|
||||
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL );
|
||||
rtl::OUString aName = xPackage->getName();
|
||||
if( !xSFA->isFolder( aExpandedHelpURL ) )
|
||||
if (compiledHelp)
|
||||
{
|
||||
rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR );
|
||||
aErrStr += rtl::OUString::createFromAscii( "No help folder" );
|
||||
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
|
||||
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
|
||||
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
|
||||
data.dataUrl = xPackage->getURL();
|
||||
}
|
||||
|
||||
Reference<XComponentContext> const & xContext = getComponentContext();
|
||||
Reference< script::XInvocation > xInvocation;
|
||||
if( xContext.is() )
|
||||
else
|
||||
{
|
||||
try
|
||||
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
|
||||
data.dataUrl = sHelpFolder;
|
||||
|
||||
Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
|
||||
rtl::OUString aHelpURL = xPackage->getURL();
|
||||
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL );
|
||||
rtl::OUString aName = xPackage->getName();
|
||||
if( !xSFA->isFolder( aExpandedHelpURL ) )
|
||||
{
|
||||
xInvocation = Reference< script::XInvocation >(
|
||||
xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
|
||||
"com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
|
||||
rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR );
|
||||
aErrStr += rtl::OUString::createFromAscii( "No help folder" );
|
||||
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
|
||||
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
|
||||
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
|
||||
}
|
||||
catch (Exception &)
|
||||
|
||||
Reference<XComponentContext> const & xContext = getComponentContext();
|
||||
Reference< script::XInvocation > xInvocation;
|
||||
if( xContext.is() )
|
||||
{
|
||||
// i98680: Survive missing lucene
|
||||
try
|
||||
{
|
||||
xInvocation = Reference< script::XInvocation >(
|
||||
xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
|
||||
"com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
|
||||
}
|
||||
catch (Exception &)
|
||||
{
|
||||
// i98680: Survive missing lucene
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scan languages
|
||||
Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true );
|
||||
sal_Int32 nLangCount = aLanguageFolderSeq.getLength();
|
||||
const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray();
|
||||
for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang )
|
||||
{
|
||||
rtl::OUString aLangURL = pSeq[iLang];
|
||||
if( xSFA->isFolder( aLangURL ) )
|
||||
// Scan languages
|
||||
Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true );
|
||||
sal_Int32 nLangCount = aLanguageFolderSeq.getLength();
|
||||
const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray();
|
||||
for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang )
|
||||
{
|
||||
std::vector< rtl::OUString > aXhpFileVector;
|
||||
|
||||
// calculate jar file URL
|
||||
sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/');
|
||||
// for example "/en"
|
||||
OUString langFolderURLSegment(
|
||||
aLangURL.copy(
|
||||
indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1));
|
||||
|
||||
//create the folder in the "temporary folder"
|
||||
::ucbhelper::Content langFolderContent;
|
||||
const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment);
|
||||
const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest);
|
||||
::dp_misc::create_folder(
|
||||
&langFolderContent,
|
||||
langFolderDest, xCmdEnv);
|
||||
|
||||
rtl::OUString aJarFile(
|
||||
makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr +
|
||||
OUSTR(".jar")));
|
||||
aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile);
|
||||
|
||||
rtl::OUString aEncodedJarFilePath = rtl::Uri::encode(
|
||||
aJarFile, rtl_UriCharClassPchar,
|
||||
rtl_UriEncodeIgnoreEscapes,
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" );
|
||||
aDestBasePath += aEncodedJarFilePath;
|
||||
aDestBasePath += rtl::OUString::createFromAscii( "/" );
|
||||
|
||||
sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1;
|
||||
|
||||
Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true );
|
||||
sal_Int32 nSubLangCount = aSubLangSeq.getLength();
|
||||
const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray();
|
||||
for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang )
|
||||
rtl::OUString aLangURL = pSeq[iLang];
|
||||
if( xSFA->isFolder( aLangURL ) )
|
||||
{
|
||||
rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang];
|
||||
if( !xSFA->isFolder( aSubFolderURL ) )
|
||||
continue;
|
||||
std::vector< rtl::OUString > aXhpFileVector;
|
||||
|
||||
implCollectXhpFiles( aSubFolderURL, aXhpFileVector );
|
||||
// calculate jar file URL
|
||||
sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/');
|
||||
// for example "/en"
|
||||
OUString langFolderURLSegment(
|
||||
aLangURL.copy(
|
||||
indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1));
|
||||
|
||||
// Copy to package (later: move?)
|
||||
rtl::OUString aDestPath = aDestBasePath;
|
||||
rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL );
|
||||
aDestPath += aPureFolderName;
|
||||
xSFA->copy( aSubFolderURL, aDestPath );
|
||||
}
|
||||
//create the folder in the "temporary folder"
|
||||
::ucbhelper::Content langFolderContent;
|
||||
const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment);
|
||||
const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest);
|
||||
::dp_misc::create_folder(
|
||||
&langFolderContent,
|
||||
langFolderDest, xCmdEnv);
|
||||
|
||||
// Call compiler
|
||||
sal_Int32 nXhpFileCount = aXhpFileVector.size();
|
||||
rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount];
|
||||
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
|
||||
{
|
||||
rtl::OUString aXhpFile = aXhpFileVector[iXhp];
|
||||
rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL );
|
||||
pXhpFiles[iXhp] = aXhpRelFile;
|
||||
}
|
||||
rtl::OUString aJarFile(
|
||||
makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr +
|
||||
OUSTR(".jar")));
|
||||
aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile);
|
||||
|
||||
rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() );
|
||||
rtl::OUString aOfficeHelpPathFileURL;
|
||||
::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL );
|
||||
rtl::OUString aEncodedJarFilePath = rtl::Uri::encode(
|
||||
aJarFile, rtl_UriCharClassPchar,
|
||||
rtl_UriEncodeIgnoreEscapes,
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" );
|
||||
aDestBasePath += aEncodedJarFilePath;
|
||||
aDestBasePath += rtl::OUString::createFromAscii( "/" );
|
||||
|
||||
HelpProcessingErrorInfo aErrorInfo;
|
||||
bool bSuccess = compileExtensionHelp(
|
||||
aOfficeHelpPathFileURL, aHelpStr, aLangURL,
|
||||
nXhpFileCount, pXhpFiles,
|
||||
langFolderDestExpanded, aErrorInfo );
|
||||
sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1;
|
||||
|
||||
if( bSuccess && xInvocation.is() )
|
||||
{
|
||||
Sequence<uno::Any> aParamsSeq( 6 );
|
||||
|
||||
aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
|
||||
|
||||
rtl::OUString aLang;
|
||||
sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' );
|
||||
if( nLastSlash != -1 )
|
||||
aLang = aLangURL.copy( nLastSlash + 1 );
|
||||
else
|
||||
aLang = rtl::OUString::createFromAscii( "en" );
|
||||
aParamsSeq[1] = uno::makeAny( aLang );
|
||||
|
||||
aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) );
|
||||
aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) );
|
||||
|
||||
aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) );
|
||||
rtl::OUString aSystemPath;
|
||||
osl::FileBase::getSystemPathFromFileURL(
|
||||
langFolderDestExpanded, aSystemPath );
|
||||
aParamsSeq[5] = uno::makeAny( aSystemPath );
|
||||
|
||||
Sequence< sal_Int16 > aOutParamIndex;
|
||||
Sequence< uno::Any > aOutParam;
|
||||
uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ),
|
||||
aParamsSeq, aOutParamIndex, aOutParam );
|
||||
}
|
||||
|
||||
if( !bSuccess )
|
||||
{
|
||||
USHORT nErrStrId = 0;
|
||||
switch( aErrorInfo.m_eErrorClass )
|
||||
Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true );
|
||||
sal_Int32 nSubLangCount = aSubLangSeq.getLength();
|
||||
const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray();
|
||||
for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang )
|
||||
{
|
||||
case HELPPROCESSING_GENERAL_ERROR:
|
||||
case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
|
||||
case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
|
||||
default: ;
|
||||
};
|
||||
rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang];
|
||||
if( !xSFA->isFolder( aSubFolderURL ) )
|
||||
continue;
|
||||
|
||||
rtl::OUString aErrStr;
|
||||
if( nErrStrId != 0 )
|
||||
{
|
||||
aErrStr = getResourceString( nErrStrId );
|
||||
implCollectXhpFiles( aSubFolderURL, aXhpFileVector );
|
||||
|
||||
// Remoce CR/LF
|
||||
rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg );
|
||||
sal_Unicode nCR = 13, nLF = 10;
|
||||
sal_Int32 nSearchCR = aErrMsg.indexOf( nCR );
|
||||
sal_Int32 nSearchLF = aErrMsg.indexOf( nLF );
|
||||
sal_Int32 nCopy;
|
||||
if( nSearchCR != -1 || nSearchLF != -1 )
|
||||
{
|
||||
if( nSearchCR == -1 )
|
||||
nCopy = nSearchLF;
|
||||
else if( nSearchLF == -1 )
|
||||
nCopy = nSearchCR;
|
||||
else
|
||||
nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF;
|
||||
|
||||
aErrMsg = aErrMsg.copy( 0, nCopy );
|
||||
}
|
||||
aErrStr += aErrMsg;
|
||||
if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() )
|
||||
{
|
||||
aErrStr += rtl::OUString::createFromAscii( " in " );
|
||||
|
||||
rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile,
|
||||
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
|
||||
aErrStr += aDecodedFile;
|
||||
if( aErrorInfo.m_nXMLParsingLine != -1 )
|
||||
{
|
||||
aErrStr += rtl::OUString::createFromAscii( ", line " );
|
||||
aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine );
|
||||
}
|
||||
}
|
||||
// Copy to package (later: move?)
|
||||
rtl::OUString aDestPath = aDestBasePath;
|
||||
rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL );
|
||||
aDestPath += aPureFolderName;
|
||||
xSFA->copy( aSubFolderURL, aDestPath );
|
||||
}
|
||||
|
||||
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
|
||||
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
|
||||
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
|
||||
// Call compiler
|
||||
sal_Int32 nXhpFileCount = aXhpFileVector.size();
|
||||
rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount];
|
||||
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
|
||||
{
|
||||
rtl::OUString aXhpFile = aXhpFileVector[iXhp];
|
||||
rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL );
|
||||
pXhpFiles[iXhp] = aXhpRelFile;
|
||||
}
|
||||
|
||||
rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() );
|
||||
rtl::OUString aOfficeHelpPathFileURL;
|
||||
::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL );
|
||||
|
||||
HelpProcessingErrorInfo aErrorInfo;
|
||||
bool bSuccess = compileExtensionHelp(
|
||||
aOfficeHelpPathFileURL, aHelpStr, aLangURL,
|
||||
nXhpFileCount, pXhpFiles,
|
||||
langFolderDestExpanded, aErrorInfo );
|
||||
|
||||
if( bSuccess && xInvocation.is() )
|
||||
{
|
||||
Sequence<uno::Any> aParamsSeq( 6 );
|
||||
|
||||
aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
|
||||
|
||||
rtl::OUString aLang;
|
||||
sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' );
|
||||
if( nLastSlash != -1 )
|
||||
aLang = aLangURL.copy( nLastSlash + 1 );
|
||||
else
|
||||
aLang = rtl::OUString::createFromAscii( "en" );
|
||||
aParamsSeq[1] = uno::makeAny( aLang );
|
||||
|
||||
aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) );
|
||||
aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) );
|
||||
|
||||
aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) );
|
||||
rtl::OUString aSystemPath;
|
||||
osl::FileBase::getSystemPathFromFileURL(
|
||||
langFolderDestExpanded, aSystemPath );
|
||||
aParamsSeq[5] = uno::makeAny( aSystemPath );
|
||||
|
||||
Sequence< sal_Int16 > aOutParamIndex;
|
||||
Sequence< uno::Any > aOutParam;
|
||||
uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ),
|
||||
aParamsSeq, aOutParamIndex, aOutParam );
|
||||
}
|
||||
|
||||
if( !bSuccess )
|
||||
{
|
||||
USHORT nErrStrId = 0;
|
||||
switch( aErrorInfo.m_eErrorClass )
|
||||
{
|
||||
case HELPPROCESSING_GENERAL_ERROR:
|
||||
case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
|
||||
case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
|
||||
default: ;
|
||||
};
|
||||
|
||||
rtl::OUString aErrStr;
|
||||
if( nErrStrId != 0 )
|
||||
{
|
||||
aErrStr = getResourceString( nErrStrId );
|
||||
|
||||
// Remoce CR/LF
|
||||
rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg );
|
||||
sal_Unicode nCR = 13, nLF = 10;
|
||||
sal_Int32 nSearchCR = aErrMsg.indexOf( nCR );
|
||||
sal_Int32 nSearchLF = aErrMsg.indexOf( nLF );
|
||||
sal_Int32 nCopy;
|
||||
if( nSearchCR != -1 || nSearchLF != -1 )
|
||||
{
|
||||
if( nSearchCR == -1 )
|
||||
nCopy = nSearchLF;
|
||||
else if( nSearchLF == -1 )
|
||||
nCopy = nSearchCR;
|
||||
else
|
||||
nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF;
|
||||
|
||||
aErrMsg = aErrMsg.copy( 0, nCopy );
|
||||
}
|
||||
aErrStr += aErrMsg;
|
||||
if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() )
|
||||
{
|
||||
aErrStr += rtl::OUString::createFromAscii( " in " );
|
||||
|
||||
rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile,
|
||||
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
|
||||
aErrStr += aDecodedFile;
|
||||
if( aErrorInfo.m_nXMLParsingLine != -1 )
|
||||
{
|
||||
aErrStr += rtl::OUString::createFromAscii( ", line " );
|
||||
aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
|
||||
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
|
||||
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Writing the data entry replaces writing the flag file. If we got to this
|
||||
//point the registration was successful.
|
||||
addDataToDb(xPackage->getURL(), data);
|
||||
}
|
||||
} //if (doRegisterPackage)
|
||||
else
|
||||
{
|
||||
deleteDataFromDb(xPackage->getURL());
|
||||
|
@@ -4,4 +4,7 @@
|
||||
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.*
|
||||
..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.*
|
||||
..\util\ucpchelp.xml %_DEST%\xml%_EXT%\ucpchelp.xml
|
||||
..\util\*.xsl %_DEST%\bin%_EXT%\*.*
|
||||
..\%__SRC%\lib\ihelplinker.lib %_DEST%\lib%_EXT%\ihelplinker.lib
|
||||
..\%__SRC%\bin\helpxsl.zip %_DEST%\pck%_EXT%\helpxsl.zip
|
||||
|
||||
|
0
xmlhelp/util/delzip
Normal file
0
xmlhelp/util/delzip
Normal file
83
xmlhelp/util/embed.xsl
Normal file
83
xmlhelp/util/embed.xsl
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output indent="yes" method="xml"/>
|
||||
|
||||
<!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES -->
|
||||
<xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/>
|
||||
|
||||
<!--
|
||||
######################################################
|
||||
All others
|
||||
######################################################
|
||||
-->
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*|@*|comment()|processing-instruction()|text()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*|@*|comment()|processing-instruction()|text()" mode="embedded">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()" mode="embedded"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bookmark" mode="embedded" />
|
||||
<xsl:template match="ahelp" mode="embedded">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph[@role='heading']">
|
||||
<title>
|
||||
<xsl:apply-templates/>
|
||||
</title>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph[@role=*]">
|
||||
<paragraph>
|
||||
<xsl:apply-templates/>
|
||||
</paragraph>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sort">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
######################################################
|
||||
EMBED
|
||||
######################################################
|
||||
-->
|
||||
<xsl:template match="embed">
|
||||
|
||||
<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
|
||||
<xsl:if test="not($doc//section[@id=$anchor])"> <!-- fallback for embeds that actually should be embedvars -->
|
||||
<paragraph role="paragraph"><xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/></paragraph>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
######################################################
|
||||
EMBEDVAR
|
||||
######################################################
|
||||
-->
|
||||
<xsl:template match="embedvar">
|
||||
<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
|
||||
<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:if>
|
||||
|
||||
<!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform -->
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
34
xmlhelp/util/idxcaption.xsl
Normal file
34
xmlhelp/util/idxcaption.xsl
Normal file
@@ -0,0 +1,34 @@
|
||||
<xsl:stylesheet version="1.0" encoding="UTF-8"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:office="http://openoffice.org/2000/office"
|
||||
xmlns:style="http://openoffice.org/2000/style"
|
||||
xmlns:table="http://openoffice.org/2000/table"
|
||||
xmlns:draw="http://openoffice.org/2000/drawing"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:meta="http://openoffice.org/2000/meta"
|
||||
xmlns:number="http://openoffice.org/2000/datastyle"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:chart="http://openoffice.org/2000/chart"
|
||||
xmlns:help="http://openoffice.org/2000/help"
|
||||
xmlns:index="http://sun.com/2000/XMLSearch"
|
||||
xmlns:text="http://openoffice.org/2000/text">
|
||||
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:output method="text" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="//title" mode="include"/>
|
||||
<xsl:apply-templates select="//paragraph[@role='heading']" mode="include"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="include">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
104
xmlhelp/util/idxcontent.xsl
Normal file
104
xmlhelp/util/idxcontent.xsl
Normal file
@@ -0,0 +1,104 @@
|
||||
<xsl:stylesheet version="1.0" encoding="UTF-8"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:office="http://openoffice.org/2000/office"
|
||||
xmlns:style="http://openoffice.org/2000/style"
|
||||
xmlns:table="http://openoffice.org/2000/table"
|
||||
xmlns:draw="http://openoffice.org/2000/drawing"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:meta="http://openoffice.org/2000/meta"
|
||||
xmlns:number="http://openoffice.org/2000/datastyle"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:chart="http://openoffice.org/2000/chart"
|
||||
xmlns:help="http://openoffice.org/2000/help"
|
||||
xmlns:index="http://sun.com/2000/XMLSearch"
|
||||
xmlns:text="http://openoffice.org/2000/text">
|
||||
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:output method="text" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="helpdocument|body">
|
||||
<xsl:choose>
|
||||
<xsl:when test="meta/topic[@indexer='exclude']"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="title">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tablecell">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tablerow">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="listitem">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="emph">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="section">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bookmark">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bookmark_value">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="link">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ahelp[@visibility='visible']">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
972
xmlhelp/util/main_transform.xsl
Normal file
972
xmlhelp/util/main_transform.xsl
Normal file
@@ -0,0 +1,972 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
|
||||
<!--***********************************************************************
|
||||
This is the main transformation style sheet for transforming.
|
||||
Only use with OOo 2.0
|
||||
Owner: fpe@openoffice.org
|
||||
=========================================================================
|
||||
Changes Log
|
||||
May 24 2004 Created
|
||||
Aug 24 2004 Fixed for help2 CWS
|
||||
Aug 27 2004 Added css link, fixed missing embed-mode for variable
|
||||
Removed width/height for images
|
||||
Sep 03 2004 Modularized xsl, added some embedded modes
|
||||
Oct 08 2004 Fixed bug wrong mode "embedded" for links
|
||||
Added embedded modes for embed and embedvar (for cascaded embeds)
|
||||
Added <p> tags around falsely embedded pars and vars
|
||||
Dec 08 2004 #i38483#, fixed wrong handling of web links
|
||||
#i37377#, fixed missing usage of Database parameter for switching
|
||||
Jan 04 2005 #i38905#, fixed buggy branding replacement template
|
||||
Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter
|
||||
evaluate new localize attribute in images
|
||||
May 10 2005 #i48785#, fixed wrong setting of distrib variable
|
||||
Aug 16 2005 workaround for #i53365#
|
||||
Aug 19 2005 fixed missing list processing in embedded sections
|
||||
Aug 19 2005 #i53535#, fixed wrong handling of Database parameter
|
||||
Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console
|
||||
Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors
|
||||
***********************************************************************//-->
|
||||
|
||||
<!--
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
|
||||
Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
|
||||
OpenOffice.org - a multi-platform office productivity suite
|
||||
|
||||
This file is part of OpenOffice.org.
|
||||
|
||||
OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License version 3
|
||||
only, as published by the Free Software Foundation.
|
||||
|
||||
OpenOffice.org is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License version 3 for more details
|
||||
(a copy is included in the LICENSE file that accompanied this code).
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
version 3 along with OpenOffice.org. If not, see
|
||||
<http://www.openoffice.org/license.html>
|
||||
for a copy of the LGPLv3 License.
|
||||
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output indent="yes" method="html"/>
|
||||
|
||||
<!--
|
||||
############################
|
||||
# Variables and Parameters #
|
||||
############################
|
||||
//-->
|
||||
|
||||
<!-- General Usage -->
|
||||
<xsl:variable name="am" select="'&'"/>
|
||||
<xsl:variable name="sl" select="'/'"/>
|
||||
<xsl:variable name="qt" select="'"'"/>
|
||||
|
||||
<!-- generic Icon alt text -->
|
||||
<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/>
|
||||
|
||||
<!-- For calculating pixel sizes -->
|
||||
<xsl:variable name="dpi" select="'96'"/>
|
||||
<xsl:variable name="dpcm" select="'38'"/>
|
||||
|
||||
<!-- Product brand variables used in the help files -->
|
||||
<xsl:variable name="brand1" select="'$[officename]'"/>
|
||||
<xsl:variable name="brand2" select="'$[officeversion]'"/>
|
||||
<xsl:variable name="brand3" select="'%PRODUCTNAME'"/>
|
||||
<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
|
||||
|
||||
<!-- meta data variables from the help file -->
|
||||
<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
|
||||
<xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/>
|
||||
<xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/>
|
||||
<xsl:variable name="title" select="/helpdocument/meta/topic/title"/>
|
||||
<xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/>
|
||||
|
||||
<!-- Module and the corresponding switching values-->
|
||||
<xsl:param name="Database" select="'swriter'"/>
|
||||
<xsl:variable name="module" select="$Database"/>
|
||||
<xsl:variable name="appl">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when>
|
||||
<xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when>
|
||||
<xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when>
|
||||
<xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when>
|
||||
<xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when>
|
||||
<xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when>
|
||||
<xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- the other parameters given by the help caller -->
|
||||
<xsl:param name="System" select="'WIN'"/>
|
||||
<xsl:param name="productname" select="'Office'"/>
|
||||
<xsl:param name="productversion" select="''"/>
|
||||
<xsl:variable name="pversion">
|
||||
<xsl:value-of select="translate($productversion,' ','')"/>
|
||||
</xsl:variable>
|
||||
<!-- this is were the images are -->
|
||||
<xsl:param name="imgrepos" select="''"/>
|
||||
<xsl:param name="Id" />
|
||||
<!-- (lame) distinction between OS and Commercial -->
|
||||
<xsl:param name="distrib">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($productname,'OpenOffice')">
|
||||
<xsl:value-of select="'OpenSource'"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="'COMMERCIAL'"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:param>
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:variable name="lang" select="$Language"/>
|
||||
|
||||
<xsl:param name="ExtensionId" select="''"/>
|
||||
<xsl:param name="ExtensionPath" select="''"/>
|
||||
|
||||
|
||||
<!-- parts of help and image urls -->
|
||||
<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>
|
||||
<xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/>
|
||||
<xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/>
|
||||
<xsl:variable name="urlpre" select="$help_url_prefix" />
|
||||
<xsl:variable name="linkprefix" select="$urlpre"/>
|
||||
<xsl:variable name="linkpostfix" select="$urlpost"/>
|
||||
|
||||
<xsl:variable name="css" select="'default.css'"/>
|
||||
|
||||
<!-- images for notes, tips and warnings -->
|
||||
<xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/>
|
||||
<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/>
|
||||
<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/>
|
||||
|
||||
<!--
|
||||
#############
|
||||
# Templates #
|
||||
#############
|
||||
//-->
|
||||
|
||||
<!-- Create the document skeleton -->
|
||||
<xsl:template match="/">
|
||||
<xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>
|
||||
<html>
|
||||
<head>
|
||||
<title><xsl:value-of select="$title"/></title>
|
||||
<link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link -->
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
</head>
|
||||
<body lang="{$lang}">
|
||||
<xsl:apply-templates select="/helpdocument/body"/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<!-- AHELP -->
|
||||
<xsl:template match="ahelp">
|
||||
<xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- ALT -->
|
||||
<xsl:template match="alt"/>
|
||||
|
||||
<!-- BOOKMARK -->
|
||||
<xsl:template match="bookmark">
|
||||
<a name="{@id}"></a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(@branch,'hid')" />
|
||||
<xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="bookmark" mode="embedded" />
|
||||
|
||||
<!-- BOOKMARK_VALUE -->
|
||||
<xsl:template match="bookmark_value" />
|
||||
|
||||
<!-- BR -->
|
||||
<xsl:template match="br"><br /></xsl:template>
|
||||
|
||||
<!-- CAPTION -->
|
||||
<xsl:template match="caption" />
|
||||
|
||||
<!-- CASE -->
|
||||
<xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
|
||||
<xsl:template match="case" mode="embedded">
|
||||
<xsl:call-template name="insertcase">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- CASEINLINE -->
|
||||
<xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template>
|
||||
<xsl:template match="caseinline" mode="embedded">
|
||||
<xsl:call-template name="insertcase">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- COMMENT -->
|
||||
<xsl:template match="comment" />
|
||||
<xsl:template match="comment" mode="embedded"/>
|
||||
|
||||
<!-- CREATED -->
|
||||
<xsl:template match="created" />
|
||||
|
||||
<!-- DEFAULT -->
|
||||
<xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template>
|
||||
<xsl:template match="default" mode="embedded">
|
||||
<xsl:call-template name="insertdefault">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DEFAULTINLINE -->
|
||||
<xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template>
|
||||
<xsl:template match="defaultinline" mode="embedded">
|
||||
<xsl:call-template name="insertdefault">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- EMBED -->
|
||||
<xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template>
|
||||
<xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template>
|
||||
|
||||
<!-- EMBEDVAR -->
|
||||
<xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template>
|
||||
<xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template>
|
||||
|
||||
<!-- EMPH -->
|
||||
<xsl:template match="emph">
|
||||
<span class="emph"><xsl:apply-templates /></span>
|
||||
</xsl:template>
|
||||
<xsl:template match="emph" mode="embedded">
|
||||
<span class="emph"><xsl:apply-templates /></span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- FILENAME -->
|
||||
<xsl:template match="filename" />
|
||||
|
||||
<!-- HISTORY -->
|
||||
<xsl:template match="history" />
|
||||
|
||||
<!-- IMAGE -->
|
||||
<xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template>
|
||||
<xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template>
|
||||
|
||||
<!-- ITEM -->
|
||||
<xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
|
||||
<xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
|
||||
|
||||
<!-- LASTEDITED -->
|
||||
<xsl:template match="lastedited" />
|
||||
|
||||
<!-- LINK -->
|
||||
<xsl:template match="link">
|
||||
<xsl:choose> <!-- don't insert the heading link to itself -->
|
||||
<xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)">
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:call-template name="insert_howtoget">
|
||||
<xsl:with-param name="linkhref" select="@href"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="createlink" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="link" mode="embedded">
|
||||
<xsl:call-template name="createlink"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- LIST -->
|
||||
<xsl:template match="list">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='ordered'">
|
||||
<ol>
|
||||
<xsl:if test="@startwith">
|
||||
<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates />
|
||||
</ol>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<ul><xsl:apply-templates /></ul>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list" mode="embedded">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='ordered'">
|
||||
<ol>
|
||||
<xsl:if test="@startwith">
|
||||
<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</ol>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<ul><xsl:apply-templates mode="embedded"/></ul>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- LISTITEM -->
|
||||
<xsl:template match="listitem">
|
||||
<li><xsl:apply-templates /></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="listitem" mode="embedded">
|
||||
<li><xsl:apply-templates mode="embedded"/></li>
|
||||
</xsl:template>
|
||||
|
||||
<!-- META, SEE HEADER -->
|
||||
<xsl:template match="meta" />
|
||||
|
||||
<!-- OBJECT (UNUSED) -->
|
||||
<xsl:template match="object" />
|
||||
|
||||
<!-- PARAGRAPH -->
|
||||
<xsl:template match="paragraph">
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@role='heading'">
|
||||
<xsl:call-template name="insertheading">
|
||||
<xsl:with-param name="level" select="@level"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(' note warning tip ',@role)">
|
||||
<xsl:call-template name="insertnote">
|
||||
<xsl:with-param name="type" select="@role" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="insertpara" />
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph" mode="embedded">
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded -->
|
||||
<!--
|
||||
The internal sablotron processor does not seem to support the number function.
|
||||
Therefore, we need a workaround for
|
||||
<xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable>
|
||||
-->
|
||||
<xsl:variable name="newlevel">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when>
|
||||
<xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when>
|
||||
<xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when>
|
||||
<xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when>
|
||||
<xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:call-template name="insertheading">
|
||||
<xsl:with-param name="level" select="$newlevel"/>
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(' note warning tip ',@role)">
|
||||
<xsl:call-template name="insertnote">
|
||||
<xsl:with-param name="type" select="@role" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="insertpara" />
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- SECTION -->
|
||||
<xsl:template match="section">
|
||||
<a name="{@id}"></a>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@id='relatedtopics'">
|
||||
<div class="relatedtopics">
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<p class="related">
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
|
||||
</p>
|
||||
<div class="relatedbody">
|
||||
<xsl:apply-templates />
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="@id='howtoget'">
|
||||
<xsl:call-template name="insert_howtoget" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- SECTION -->
|
||||
<xsl:template match="section" mode="embedded">
|
||||
<a name="{@id}"></a>
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- SORT -->
|
||||
<xsl:template match="sort" >
|
||||
<!-- sorting disabled due to #i70462#
|
||||
<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
|
||||
//-->
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
<xsl:template match="sort" mode="embedded">
|
||||
<!-- sorting disabled due to #i70462#
|
||||
<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
|
||||
//-->
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<!-- SWITCH -->
|
||||
<xsl:template match="switch"><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template>
|
||||
|
||||
<!-- SWITCHINLINE -->
|
||||
<xsl:template match="switchinline"><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template>
|
||||
|
||||
<!-- TABLE -->
|
||||
<xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template>
|
||||
<xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template>
|
||||
|
||||
<!-- TABLECELL -->
|
||||
<xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template>
|
||||
<xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template>
|
||||
<xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template>
|
||||
|
||||
<!-- TABLEROW -->
|
||||
<xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template>
|
||||
<xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template>
|
||||
<xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template>
|
||||
|
||||
<!-- TITLE -->
|
||||
<xsl:template match="title"/>
|
||||
|
||||
<!-- TOPIC -->
|
||||
<xsl:template match="topic"/>
|
||||
|
||||
<!-- VARIABLE -->
|
||||
<xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
|
||||
|
||||
<xsl:template match="text()">
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()" mode="embedded">
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- In case of missing help files -->
|
||||
<xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template>
|
||||
|
||||
<!--
|
||||
###################
|
||||
# NAMED TEMPLATES #
|
||||
###################
|
||||
//-->
|
||||
|
||||
<!-- Branding -->
|
||||
<xsl:template name="brand" >
|
||||
<xsl:param name="string"/>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="contains($string,$brand1)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand1)"/>
|
||||
<xsl:value-of select="$productname"/>
|
||||
<xsl:value-of select="substring-after($string,$brand1)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand2)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand2)"/>
|
||||
<xsl:value-of select="$pversion"/>
|
||||
<xsl:value-of select="substring-after($string,$brand2)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand3)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand3)"/>
|
||||
<xsl:value-of select="$productname"/>
|
||||
<xsl:value-of select="substring-after($string,$brand3)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand4)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand4)"/>
|
||||
<xsl:value-of select="$pversion"/>
|
||||
<xsl:value-of select="substring-after($string,$brand4)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$string"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Insert Paragraph -->
|
||||
<xsl:template name="insertpara">
|
||||
<xsl:variable name="role">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::table">
|
||||
<xsl:value-of select="concat(@role,'intable')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@role"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<p class="{$role}"><xsl:apply-templates /></p>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert "How to get Link" -->
|
||||
<xsl:template name="insert_howtoget">
|
||||
<xsl:param name="linkhref" />
|
||||
<xsl:variable name="archive" select="'shared'"/>
|
||||
<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="tmp_doc" select="document($tmp_href)"/>
|
||||
<table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p>
|
||||
<div class="howtogetbody">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$linkhref = ''"> <!-- new style -->
|
||||
<xsl:apply-templates/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- old style -->
|
||||
<xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable>
|
||||
<xsl:variable name="docum" select="document($href)"/>
|
||||
|
||||
<xsl:call-template name="insertembed">
|
||||
<xsl:with-param name="doc" select="$docum" />
|
||||
<xsl:with-param name="anchor" select="$anc" />
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Create a link -->
|
||||
<xsl:template name="createlink">
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(@href,'http://')"> <!-- web links -->
|
||||
<a href="{@href}"><xsl:apply-templates /></a>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(@href,'#')">
|
||||
<xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable>
|
||||
<a href="{$href}"><xsl:apply-templates /></a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable>
|
||||
<a href="{$href}"><xsl:apply-templates /></a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert Note, Warning, or Tip -->
|
||||
<xsl:template name="insertnote">
|
||||
<xsl:param name="type" /> <!-- note, tip, or warning -->
|
||||
<xsl:variable name="imgsrc">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when>
|
||||
<xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when>
|
||||
<xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="alt">
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:variable>
|
||||
<div class="{$type}">
|
||||
<table border="0" class="{$type}" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td>
|
||||
<td><xsl:apply-templates /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert a heading -->
|
||||
<xsl:template name="insertheading">
|
||||
<xsl:param name="level" />
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:text disable-output-escaping="yes"><h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text disable-output-escaping="yes"></h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Evaluate a case or caseinline switch -->
|
||||
<xsl:template name="insertcase">
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
|
||||
<xsl:if test="@select = $System">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
|
||||
<xsl:if test="@select = $appl">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
|
||||
<xsl:if test="@select = $distrib">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Evaluate a default or defaultinline switch -->
|
||||
<xsl:template name="insertdefault">
|
||||
<xsl:param name="embedded" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
|
||||
<xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
|
||||
<xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
|
||||
<xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- evaluate embeds -->
|
||||
<xsl:template name="insertembed">
|
||||
<xsl:param name="doc" />
|
||||
<xsl:param name="anchor" />
|
||||
<!-- different embed targets (also falsely used embed instead embedvar) -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name -->
|
||||
<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name -->
|
||||
<p class="embedded">
|
||||
<xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name -->
|
||||
<p class="embedded">
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- then give up -->
|
||||
<p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert an image -->
|
||||
<xsl:template name="insertimage">
|
||||
|
||||
<xsl:variable name="fpath">
|
||||
<xsl:call-template name="getfpath">
|
||||
<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="fname">
|
||||
<xsl:call-template name="getfname">
|
||||
<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="src">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)">
|
||||
<xsl:value-of select="concat($ExtensionPath,'/',@src)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(@localize='true') and not($lang='en-US')">
|
||||
<xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
|
||||
<xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
|
||||
<xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size -->
|
||||
<xsl:variable name="height" select="''"/><!-- Image don't all have the correct size -->
|
||||
<img src="{$src}" alt="{$alt}" title="{$alt}">
|
||||
<xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if>
|
||||
<xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if>
|
||||
</img>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert a Table -->
|
||||
<xsl:template name="inserttable">
|
||||
<xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
|
||||
<xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="count(descendant::tablecell)=1">
|
||||
<table border="0" class="onecell" cellpadding="0" cellspacing="0">
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="descendant::tablecell[1]/descendant::image">
|
||||
<table border="0" class="icontable" cellpadding="5" cellspacing="0">
|
||||
<xsl:apply-templates mode="icontable"/>
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="@class='wide'">
|
||||
<table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="not(@class='')">
|
||||
<table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<table border="1" class="border" cellpadding="0" cellspacing="0" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="resolveembed">
|
||||
<div class="embedded">
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="docum" select="document($href)"/>
|
||||
|
||||
<xsl:call-template name="insertembed">
|
||||
<xsl:with-param name="doc" select="$docum" />
|
||||
<xsl:with-param name="anchor" select="$anc" />
|
||||
</xsl:call-template>
|
||||
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="resolveembedvar">
|
||||
<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name -->
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- or give up -->
|
||||
<span class="bug">[<xsl:value-of select="@href"/> not found].</span>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Apply -->
|
||||
<xsl:template name="apply">
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="getfpath">
|
||||
<xsl:param name="s"/>
|
||||
<xsl:param name="p"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,'/')">
|
||||
<xsl:call-template name="getfpath">
|
||||
<xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param>
|
||||
<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$p"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="getfname">
|
||||
<xsl:param name="s"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,'/')">
|
||||
<xsl:call-template name="getfname">
|
||||
<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$s"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="createDBpostfix">
|
||||
<xsl:param name="archive"/>
|
||||
<xsl:variable name="newDB">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="concat($am,'DbPAR=',$newDB)"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -74,5 +74,11 @@ DEF1NAME=$(SHL1TARGET)
|
||||
|
||||
# --- Targets ----------------------------------------------------------
|
||||
|
||||
ZIP1TARGET=helpxsl
|
||||
ZIP1FLAGS= -u -r
|
||||
#ZIP1DIR=$(PRJ)$/source$/auxiliary
|
||||
ZIP1LIST=main_transform*.xsl idxcaption.xsl idxcontent.xsl
|
||||
|
||||
|
||||
.INCLUDE: target.mk
|
||||
|
||||
|
Reference in New Issue
Block a user