最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】cygwin中的docbook中使用xsltproc时命令行中通过–stringparam传入的参数无效

Docbook crifan 3545浏览 0评论

【问题】

在cygwin中搭建的docbook开发环境。

用到了xsltproc去处理xml。

其中通过–stringparam传入参数:

--stringparam webhelp.autolabel 1

结果最后生成的webhelp中的toc目录中没有索引编号,即webhelp.autolabel这个参数没有生效。

详见:

【记录】使用docbook的docbook-xsl-ns-1.78.1替换旧的ant改用make去编译webhelp

现在是希望解决此问题。

搞清楚为何参数没有生效。

【解决过程】

1.后来怀疑是:

xsltproc的stringparam和xsltproc所处理的xsl文件的前后顺序,或许决定了参数是否有效

即:

此处由于是xsl文件放在了stringparam后面,所以xsl文件中的配置,才真正起效果了。

即:

xsltproc以最后传入的参数为准。

2.那么就去试试:

把stringparam参数,放在xsl文件后面:

	@#xsltproc ${WEBHELP_OTHER_XSLTPROC_ARGS} $(TOOLS_XSL_NS_WEBHELP)/xsl/webhelp.xsl xincluded-profiled.xml
	xsltproc $(TOOLS_XSL_NS_WEBHELP)/xsl/webhelp.xsl ${WEBHELP_OTHER_XSLTPROC_ARGS} xincluded-profiled.xml

看看是否生效:

结果出错了:

CLi@PC-CLI-1 ~/develop/docbook/books/crifanlib_python/src
$ make webhelp
rm -rf ../output/webhelp
mkdir -p ../output/webhelp
cp -a ./images ../output/webhelp
test ! -d ./images/ || cp -a ./images/ ../output/webhelp
cp D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/favicon.ico ../output/webhelp/
xsltproc \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch "" \
          --stringparam  profile.audience "" \
          --stringparam  profile.condition "" \
          --stringparam  profile.conformance "" \
          --stringparam  profile.lang "" \
          --stringparam  profile.os "" \
          --stringparam  profile.revision "" \
          --stringparam  profile.revisionflag "" \
          --stringparam  profile.role "" \
          --stringparam  profile.security "" \
          --stringparam  profile.status "" \
          --stringparam  profile.userlevel "" \
          --stringparam  profile.vendor "" \
          --stringparam  profile.wordsize "" \
          --stringparam  profile.attribute "" \
          --stringparam  profile.value "" \
          D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/profiling/profile.xsl  \
          ./crifanlib_python.xml
xsltproc D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/xsl/webhelp.xsl --stringparam webhelp.base.dir ../output/webhelp --stringparam webhelp.autolabel 1 --stringparam webhelp.indexer.language zh --stringparam webhelp.common.dir file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/ xincluded-profiled.xml
warning: failed to load external entity "--stringparam"
unable to parse --stringparam
warning: failed to load external entity "webhelp.base.dir"
unable to parse webhelp.base.dir
I/O error : Is a directory
../output/webhelp:1: parser error : Document is empty

^
../output/webhelp:1: parser error : Start tag expected, '<' not found

^
unable to parse ../output/webhelp
warning: failed to load external entity "--stringparam"
unable to parse --stringparam
warning: failed to load external entity "webhelp.autolabel"
unable to parse webhelp.autolabel
warning: failed to load external entity "1"
unable to parse 1
warning: failed to load external entity "--stringparam"
unable to parse --stringparam
warning: failed to load external entity "webhelp.indexer.language"
unable to parse webhelp.indexer.language
warning: failed to load external entity "zh"
unable to parse zh
warning: failed to load external entity "--stringparam"
unable to parse --stringparam
warning: failed to load external entity "webhelp.common.dir"
unable to parse webhelp.common.dir
warning: failed to load external entity "file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/"
unable to parse file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/
language: zh
Writing ../output/webhelp/what_is_crifanlib_py.html for sect1(what_is_crifanlib_py)
Writing ../output/webhelp/where_download_crifanlib_py.html for sect1(where_download_crifanlib_py)
Writing ../output/webhelp/ch01_crifanlib_py_intro.html for chapter(ch01_crifanlib_py_intro)
Writing ../output/webhelp/getcurtimestamp.html for sect2(getcurtimestamp)
Writing ../output/webhelp/timestamptodatetime.html for sect2(timestamptodatetime)
Writing ../output/webhelp/calctimestart_calctimeend.html for sect2(calctimestart_calctimeend)
Writing ../output/webhelp/convertlocaltogmt.html for sect2(convertlocaltogmt)
Writing ../output/webhelp/time_datetime_funcs.html for sect1(time_datetime_funcs)
Writing ../output/webhelp/extractfilename.html for sect2(extractfilename)
Writing ../output/webhelp/repuninumenttochar.html for sect2(repuninumenttochar)
Writing ../output/webhelp/genfullurl.html for sect2(genfullurl)
Writing ../output/webhelp/urlissimilar.html for sect2(urlissimilar)
Writing ../output/webhelp/findsimilarurl.html for sect2(findsimilarurl)
Writing ../output/webhelp/removenonwordchar.html for sect2(removenonwordchar)
Writing ../output/webhelp/removectlchr.html for sect2(removectlchr)
Writing ../output/webhelp/replacestrenttonument.html for sect2(replacestrenttonument)
Writing ../output/webhelp/converttotupleval.html for sect2(converttotupleval)
Writing ../output/webhelp/removeemptyinlist.html for sect2(removeemptyinlist)
Writing ../output/webhelp/uniquelist.html for sect2(uniquelist)
Writing ../output/webhelp/filterlist.html for sect2(filterlist)
Writing ../output/webhelp/randdigitsstr.html for sect2(randdigitsstr)
Writing ../output/webhelp/tuplelisttodict.html for sect2(tuplelisttodict)
Writing ../output/webhelp/string_unicode_funcs.html for sect1(string_unicode_funcs)
Writing ../output/webhelp/savebindatatofile.html for sect2(savebindatatofile)
Writing ../output/webhelp/file_funcs.html for sect1(file_funcs)
Writing ../output/webhelp/isfilevalid.html for sect2(isfilevalid)
Writing ../output/webhelp/downloadfile.html for sect2(downloadfile)
Writing ../output/webhelp/manuallydownloadfile.html for sect2(manuallydownloadfile)
Writing ../output/webhelp/geturlresponse.html for sect2(geturlresponse)
Writing ../output/webhelp/geturlresphtml.html for sect2(geturlresphtml)
Writing ../output/webhelp/checkallcookiesexist.html for sect2(checkallcookiesexist)
Writing ../output/webhelp/network_http_funcs.html for sect1(network_http_funcs)
Writing ../output/webhelp/strisascii.html for sect2(strisascii)
Writing ../output/webhelp/getstrpossiblecharset.html for sect2(getstrpossiblecharset)
Writing ../output/webhelp/str_encoding_funcs.html for sect1(str_encoding_funcs)
Writing ../output/webhelp/translatestring.html for sect2(translatestring)
Writing ../output/webhelp/transzhcntoen.html for sect2(transzhcntoen)
Writing ../output/webhelp/language_translate_funcs.html for sect1(language_translate_funcs)
Writing ../output/webhelp/removesoupcontentstagattr.html for sect2(removesoupcontentstagattr)
Writing ../output/webhelp/findfirstnavigablestring.html for sect2(findfirstnavigablestring)
Writing ../output/webhelp/soupcontentstounicode.html for sect2(soupcontentstounicode)
Writing ../output/webhelp/beautifulsoup_funcs.html for sect1(beautifulsoup_funcs)
Writing ../output/webhelp/ch02_crifanlib_py_functions.html for chapter(ch02_crifanlib_py_functions)
Writing ../output/webhelp/reference.html for bibliography(reference)
Writing ../output/webhelp/index.html for book
Writing ../output/webhelp/search/l10n.js
make: *** [webhelp_chunk] Error 6

CLi@PC-CLI-1 ~/develop/docbook/books/crifanlib_python/src
$

3.看了看help:

CLi@PC-CLI-1 ~/develop/docbook/books/crifanlib_python/src
$ xsltproc --help
Unknown option --help
Usage: xsltproc [options] stylesheet file [file ...]
   Options:
        --version or -V: show the version of libxml and libxslt used
        --verbose or -v: show logs of what's happening
        --output file or -o file: save to a given file
        --timing: display the time used
        --repeat: run the transformation 20 times
        --debug: dump the tree of the result instead
        --dumpextensions: dump the registered extension elements and functions to stdout
        --novalid skip the DTD loading phase
        --nodtdattr do not default attributes from the DTD
        --noout: do not dump the result
        --maxdepth val : increase the maximum depth (default 3000)
        --maxvars val : increase the maximum variables (default 15000)
        --maxparserdepth val : increase the maximum parser depth
        --html: the input document is(are) an HTML file(s)
        --encoding: the input document character encoding
        --param name value : pass a (parameter,value) pair
               value is an UTF8 XPath expression.
               string values must be quoted like "'string'"
 or            use stringparam to avoid it
        --stringparam name value : pass a (parameter, UTF8 string value) pair
        --path 'paths': provide a set of paths for resources
        --nonet : refuse to fetch DTDs or entities over network
        --nowrite : refuse to write to any file or resource
        --nomkdir : refuse to create directories
        --writesubtree path : allow file write only with the path subtree
        --catalogs : use SGML catalogs from $SGML_CATALOG_FILES
                     otherwise XML Catalogs starting from
                 file:///etc/xml/catalog are activated by default
        --xinclude : do XInclude processing on document input
        --xincludestyle : do XInclude processing on stylesheets
        --load-trace : print trace of all external entites loaded
        --profile or --norman : dump profiling informations

Project libxslt home page: http://xmlsoft.org/XSLT/
To report bugs and get help: http://xmlsoft.org/XSLT/bugs.html

结果只是,先参数,再stylesheet,再是要处理的文件

所以:

此处不能先stylesheet 再加参数,否则会被默认为要处理的file。

4.这里:

[xslt] xsltproc: –stringparam under Cygwin?

也遇到参数问题,但是和我遇到的不一样。

5.看到:

xsltproc – Unix, Linux Command

中说了,stringparam的参数,必须是UTF-8

而我去确认了,我的makefile文件,的确就是UTF-8编码,且这些参数,都只是纯ASCII的,

即使传入到GBK的cmd(实际上此处是Cygwin下的mintty),也还是ASCII,也还是可以被当做UTF-8的,

所以应该不是参数的字符串的编码问题。

6.参考:

Parameters on the command line

中,也是正常这么传入参数的:

Using parameters with xsltproc:
xsltproc  --output myfile.html  \
  --stringparam  html.stylesheet "corpstyle.css"  \
  --stringparam  admon.graphics 1 \
  docbook.xsl  myfile.xml

所以,此处也是正常的。

7.对于:

RE: [xsl] xsltproc and stringparam, changed behavior

没太看懂。。。

看到别人的解释:

RE: [xsl] xsltproc and stringparam, changed behavior

好像是和什么global和local的参数有关。

而且需要你最好都显示的,通过xsl去配置参数。

(但是我还是希望可以通过stringparam,传入一些对应的参数的)

8.后来在:

ftp://ftp.zlatkovic.com/pub/libxml/64bit/

http://xmlsoft.org/sources/win32/

找到了更新版本的,win32的xsltproc,所以,可以去试试,这个新版本的,是否可以正常传入此参数。

但是在合并获得xsltproc期间,出现:

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc/bin
$ pwd
/home/CLi/develop/docbook/tools/xsltproc/bin

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc/bin
$ ls
iconv.exe*  libcharset-1.dll*  libexslt-0.dll*  libiconv-2.dll*  libxml2.dll*  libxslt-1.dll*  xmlcatalog.exe*  xmllint.exe*  xslt-config*  xsltproc.exe*  zlib1.dll*

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc/bin
$ ./xsltproc --help
/home/CLi/develop/docbook/tools/xsltproc/bin/xsltproc.exe: error while loading shared libraries: libxml2-2.dll: cannot open shared object file: No such file or directory

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc/bin
$

然后又从另外的网站:

http://leaf.argyr.net/built/libxml2/

下载到:

libxml2-2.8.0-x86-win32nt-mingw.zip

libxml2-2.8.0-x86-win32nt-msvc.zip

解压:

libxml2-2.8.0-x86-win32nt-mingw.zip

才看到其中:

D:\tmp\dev_tools\docbook\docbook_libxml\libxml2-2.8.0-x86-win32nt-mingw\bin

有:

libxml2-2.dll

然后重新合并出一个xsltproc,结果cygwin下运行还是不行:

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0
$ ls
bin/  include/  lib/  share/

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0
$ cd bin/

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ ls
iconv.exe*  libcharset-1.dll*  libexslt-0.dll*  libiconv-2.dll*  libxml2-2.dll*  libxslt-1.dll*  xmlcatalog.exe*  xmllint.exe*  xslt-config*  xsltproc.exe*  zlib1.dll*

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ ./xsltproc --help
/home/CLi/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin/xsltproc.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$

然后再去cmd中运行:

xslrproc lack libgcc_s_sjlj-1.dll file

即缺少

libgcc_s_sjlj-1.dll

所以再去解压:

mingwrt-4.8.0-win32.7z

然后得到上面的dll,合并进来,再去cmd中运行:

xsltproc htmlDocContentDumpFormatOutput could not be located

还是不行。

9.目前的,只有cygwin本身自带安装的xsltproc可用,版本是:

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ xsltproc --version
Using libxml 20901, libxslt 10127 and libexslt 816
xsltproc was compiled against libxml 20900, libxslt 10127 and libexslt 816
libxslt 10127 was compiled against libxml 20900
libexslt 816 was compiled against libxml 20900

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ which xsltproc
/bin/xsltproc

10.另外,通过:

libxml2-2.7.8:libxml2-2.7.8.win32.zip

libxslt-1.1.26:libxslt-1.1.26.win32.zip

iconv-1.14:iconv-1.14-win32.7z

zlib-1.2.8:zlib-1.2.8-win32.7z

mingwrt-4.8.0:mingwrt-4.8.0-win32.7z

终于合并出一个可用的xsltproc了:

D:\tmp\dev_tools\docbook\docbook_libxml\xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0\bin>xsltproc --version
Using libxml 20708, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20706, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20706
libexslt 815 was compiled against libxml 20706

D:\tmp\dev_tools\docbook\docbook_libxml\xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0\bin>pwd
/cygdrive/d/tmp/dev_tools/docbook/docbook_libxml/xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0/bin

D:\tmp\dev_tools\docbook\docbook_libxml\xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0\bin>

可看出,版本是20708,比cygwin中的20901还更低。

但是可用,且是win32版本的xsltproc。

所以,现在去试试,此版本的,是不是也是参数无法传入。

CLi@PC-CLI-1 ~/develop/docbook/books/crifanlib_python/src
$ make webhelp
rm -rf ../output/webhelp
mkdir -p ../output/webhelp
cp -a ./images ../output/webhelp
test ! -d ./images/ || cp -a ./images/ ../output/webhelp
cp D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/favicon.ico ../output/webhelp/
/cygdrive/d/tmp/dev_tools/docbook/docbook_libxml/xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0/bin/xsltproc \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch "" \
          --stringparam  profile.audience "" \
          --stringparam  profile.condition "" \
          --stringparam  profile.conformance "" \
          --stringparam  profile.lang "" \
          --stringparam  profile.os "" \
          --stringparam  profile.revision "" \
          --stringparam  profile.revisionflag "" \
          --stringparam  profile.role "" \
          --stringparam  profile.security "" \
          --stringparam  profile.status "" \
          --stringparam  profile.userlevel "" \
          --stringparam  profile.vendor "" \
          --stringparam  profile.wordsize "" \
          --stringparam  profile.attribute "" \
          --stringparam  profile.value "" \
          D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/profiling/profile.xsl  \
          ./crifanlib_python.xml
/cygdrive/d/tmp/dev_tools/docbook/docbook_libxml/xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0/bin/xsltproc --stringparam webhelp.base.dir ../output/webhelp --stringparam webhelp.autolabel 1 --stringparam webhelp.indexer.language zh --stringparam webhelp.common.dir file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/ D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/xsl/webhelp.xsl xincluded-profiled.xml
language: zh
Writing ../output/webhelp/what_is_crifanlib_py.html for sect1(what_is_crifanlib_py)
Writing ../output/webhelp/where_download_crifanlib_py.html for sect1(where_download_crifanlib_py)
Writing ../output/webhelp/ch01_crifanlib_py_intro.html for chapter(ch01_crifanlib_py_intro)
Writing ../output/webhelp/getcurtimestamp.html for sect2(getcurtimestamp)
Writing ../output/webhelp/timestamptodatetime.html for sect2(timestamptodatetime)
Writing ../output/webhelp/calctimestart_calctimeend.html for sect2(calctimestart_calctimeend)
Writing ../output/webhelp/convertlocaltogmt.html for sect2(convertlocaltogmt)
Writing ../output/webhelp/time_datetime_funcs.html for sect1(time_datetime_funcs)
Writing ../output/webhelp/extractfilename.html for sect2(extractfilename)
Writing ../output/webhelp/repuninumenttochar.html for sect2(repuninumenttochar)
Writing ../output/webhelp/genfullurl.html for sect2(genfullurl)
Writing ../output/webhelp/urlissimilar.html for sect2(urlissimilar)
Writing ../output/webhelp/findsimilarurl.html for sect2(findsimilarurl)
Writing ../output/webhelp/removenonwordchar.html for sect2(removenonwordchar)
Writing ../output/webhelp/removectlchr.html for sect2(removectlchr)
Writing ../output/webhelp/replacestrenttonument.html for sect2(replacestrenttonument)
Writing ../output/webhelp/converttotupleval.html for sect2(converttotupleval)
Writing ../output/webhelp/removeemptyinlist.html for sect2(removeemptyinlist)
Writing ../output/webhelp/uniquelist.html for sect2(uniquelist)
Writing ../output/webhelp/filterlist.html for sect2(filterlist)
Writing ../output/webhelp/randdigitsstr.html for sect2(randdigitsstr)
Writing ../output/webhelp/tuplelisttodict.html for sect2(tuplelisttodict)
Writing ../output/webhelp/string_unicode_funcs.html for sect1(string_unicode_funcs)
Writing ../output/webhelp/savebindatatofile.html for sect2(savebindatatofile)
Writing ../output/webhelp/file_funcs.html for sect1(file_funcs)
Writing ../output/webhelp/isfilevalid.html for sect2(isfilevalid)
Writing ../output/webhelp/downloadfile.html for sect2(downloadfile)
Writing ../output/webhelp/manuallydownloadfile.html for sect2(manuallydownloadfile)
Writing ../output/webhelp/geturlresponse.html for sect2(geturlresponse)
Writing ../output/webhelp/geturlresphtml.html for sect2(geturlresphtml)
Writing ../output/webhelp/checkallcookiesexist.html for sect2(checkallcookiesexist)
Writing ../output/webhelp/network_http_funcs.html for sect1(network_http_funcs)
Writing ../output/webhelp/strisascii.html for sect2(strisascii)
Writing ../output/webhelp/getstrpossiblecharset.html for sect2(getstrpossiblecharset)
Writing ../output/webhelp/str_encoding_funcs.html for sect1(str_encoding_funcs)
Writing ../output/webhelp/translatestring.html for sect2(translatestring)
Writing ../output/webhelp/transzhcntoen.html for sect2(transzhcntoen)
Writing ../output/webhelp/language_translate_funcs.html for sect1(language_translate_funcs)
Writing ../output/webhelp/removesoupcontentstagattr.html for sect2(removesoupcontentstagattr)
Writing ../output/webhelp/findfirstnavigablestring.html for sect2(findfirstnavigablestring)
Writing ../output/webhelp/soupcontentstounicode.html for sect2(soupcontentstounicode)
Writing ../output/webhelp/beautifulsoup_funcs.html for sect1(beautifulsoup_funcs)
Writing ../output/webhelp/ch02_crifanlib_py_functions.html for chapter(ch02_crifanlib_py_functions)
Writing ../output/webhelp/reference.html for bibliography(reference)
Writing ../output/webhelp/index.html for book
Writing ../output/webhelp/search/l10n.js
rm xincluded-profiled.xml
java \
        -DhtmlDir=../output/webhelp \
        -DindexerLanguage=zh \
        -DhtmlExtension=html \
        -DdoStem=true \
        -DindexerExcludedFiles=ix01.html \
        -Dorg.xml.sax.driver=org.ccil.cowan.tagsoup.Parser \
        -Djavax.xml.parsers.SAXParserFactory=org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl \
        -classpath "D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/webhelpindexer.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/tagsoup-1.2.1.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-analyzers-3.0.0.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-core-3.0.0.jar" \
        com.nexwave.nquindexer.IndexerMain
Stemming enabled
The created index files are located in ..\output\webhelp\search
Indexed the contents in 885 milliseconds
mkdir -p ../output/webhelp/search
cp -r D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/search/* ../output/webhelp/search
=============================== generating crifanlib_python webhelp ==============================

CLi@PC-CLI-1 ~/develop/docbook/books/crifanlib_python/src
$

去看看输出的webhelp,看看效果。

结果也还是

–stringparam webhelp.autolabel 1

没生效,目录没索引编号:

xsltproc 20708 generated webhelp still toc no index number

11.至此,对于xsltproc,不论是用:

cmd下的

D:\tmp\dev_tools\docbook\docbook_libxml\xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0\bin>xsltproc --version
Using libxml 20708, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20706, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20706
libexslt 815 was compiled against libxml 20706

还是cygwin下的:

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ which xsltproc
/bin/xsltproc

CLi@PC-CLI-1 ~/develop/docbook/tools/xsltproc_libxml2-2.8.0/bin
$ xsltproc --version
Using libxml 20901, libxslt 10127 and libexslt 816
xsltproc was compiled against libxml 20900, libxslt 10127 and libexslt 816
libxslt 10127 was compiled against libxml 20900
libexslt 816 was compiled against libxml 20900

目前,都是可以正常的,编译webhelp的,

意味着:

处理xsl文件时,内部引用本地css,js等文件时,路径无需加上那个file:///的前缀,是可以正常处理的。

但是此处的–stringparam参数,比如:

–stringparam webhelp.autolabel 1

却还是没有生效的。

还是没找到原因。

12.目前,还是需要像:

【记录】docbook的docbook-xsl-ns-1.78.1中的webhelp:优化使得共用之前的chunk等公共的xsl配置

中, 通过另外的xsl中,设置对应的:

<xsl:param name="webhelp.autolabel">1</xsl:param>

而实现此参数的效果。

13.再去试试,把参数都加上引号:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam "webhelp.autolabel" "1" \
    --stringparam webhelp.indexer.language $(WEBHELP_INDEX_LANGUAGE)


XSLTPROC=xsltproc
#XSLTPROC=/cygdrive/d/tmp/dev_tools/docbook/docbook_libxml/xsltproc_libxml2-2.7.8_libxslt-1.1.26_iconv-1.14_zlib-1.2.8_mingwrt-4.8.0/bin/xsltproc

webhelp_chunk:
	$(XSLTPROC) \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch ${PROFILE.ARCH} \
          --stringparam  profile.audience ${PROFILE.AUDIENCE} \
          --stringparam  profile.condition ${PROFILE.CONDITION} \
          --stringparam  profile.conformance ${PROFILE.CONFORMANCE} \
          --stringparam  profile.lang ${PROFILE.LANG} \
          --stringparam  profile.os ${PROFILE.OS} \
          --stringparam  profile.revision ${PROFILE.REVISION} \
          --stringparam  profile.revisionflag ${PROFILE.REVISIONFLAG} \
          --stringparam  profile.role ${PROFILE.ROLE} \
          --stringparam  profile.security ${PROFILE.SECURITY} \
          --stringparam  profile.status ${PROFILE.STATUS} \
          --stringparam  profile.userlevel ${PROFILE.USERLEVEL} \
          --stringparam  profile.vendor ${PROFILE.VENDOR} \
          --stringparam  profile.wordsize ${PROFILE.WORDSIZE} \
          --stringparam  profile.attribute ${PROFILE.ATTRIBUTE} \
          --stringparam  profile.value ${PROFILE.VALUE} \
          $(TOOLS_XSL_NS_PROFILING)/profile.xsl  \
          $(MAIN_SRC_FILE)
	$(XSLTPROC) ${WEBHELP_OTHER_XSLTPROC_ARGS} $(TOOLS_XSL_NS_WEBHELP)/xsl/webhelp.xsl xincluded-profiled.xml
	@#$(XSLTPROC) $(TOOLS_XSL_NS_WEBHELP)/xsl/webhelp.xsl ${WEBHELP_OTHER_XSLTPROC_ARGS} xincluded-profiled.xml
	rm xincluded-profiled.xml

结果问题依旧。

14.是不是,此处stringparam设置了参数,但是xsl文件中,没有此参数,所以就失效了?

所以,去试试,给

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\webhelp\xsl\webhelp.xsl

所引用到的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\webhelp\xsl\webhelp-common.xsl

中,添加此参数,但是故意改为0:

<xsl:param name="webhelp.autolabel" select="0"/>

但是stringparam中是1:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.autolabel 1 \

结果是:

问题依旧。

15.再去把

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\webhelp\xsl\webhelp-common.xsl

中设置为1:

<xsl:param name="webhelp.autolabel" select="1"/>

但是命令行中设置为0:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.autolabel 0 \

结果是,现象如前,目录中没有索引编号。

16.那再保持xsl中为1,参数中也是1:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.autolabel 1 \

结果是:

竟然也不行。

17.所以,看来不是此处的参数没有传入的问题,应该是没有引用到相关的参数配置而导致的。

算了,暂时不弄了。

等抽空换到另外一个系统中,是已经:

【记录】docbook的docbook-xsl-ns-1.78.1中的webhelp:优化使得共用之前的chunk等公共的xsl配置

过了,即已经调用了我自己的

webhelp_crl.xsl

了,那是至少是自己xsl中设置了:

<xsl:param name="webhelp.autolabel" select="1"/>

然后参数stringparam中没有再去设置webhelp.autolabel,然后是可以正常让目录有索引编号的。

18.再去试试一次:

xsl中设置:

<xsl:param name="webhelp.autolabel" select="1"/>

但是参数中不设置:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.indexer.language $(WEBHELP_INDEX_LANGUAGE)

#    --stringparam webhelp.autolabel 1 \

看看结果:

结果此处还是不行。

所以:

只能是之后换个环境再折腾了。

懒得去确认此处是什么问题导致xsl配置和参数配置,都不生效的问题了。

19.换了个环境,当前是可以正常生成webhelp的目标带索引编号的。

然后去试试:

(1)–stringparam webhelp.autolabel 0,<xsl:param name="webhelp.autolabel">1</xsl:param>

结果是:没生效。

(2)–stringparam webhelp.autolabel 1,<xsl:param name="webhelp.autolabel">1</xsl:param>

结果是:生效了。

(3)–stringparam webhelp.autolabel 1,<xsl:param name="webhelp.autolabel">0</xsl:param>

结果是:生效了;

(4)–stringparam webhelp.autolabel 0,<xsl:param name="webhelp.autolabel">0</xsl:param>

结果是:没生效。

(5)不设置–stringparam,<xsl:param name="webhelp.autolabel">0</xsl:param>

结果是:没生效。

(6)不设置–stringparam,<xsl:param name="webhelp.autolabel">1</xsl:param>

结果是:生效了。

(7)对于不去在xsl中配置,那就算了,毕竟还需要去改动默认自带的xsl,就比较麻烦。

 

【总结】

很显然,结论是和我的猜测是一致的:

对于xsltproc的参数控制,通过命令行传入的–stringparam的优先级,要高于xsl配置文件。

当然,没有通过–stringparam去设置参数的话,那么,当前是以xsl中的配置优先。

同时需要注意的是:

即使是xsl中的配置,也是,应该说所有docbook中(关于html,chunk,webhelp等)的配置参数,

都是有默认的xsl去配置的。

然后你是自己写了个自己的xsl文件,调用了docbook自带的xsl配置,

然后再写你自己的配置,达到覆盖原有默认配置的效果。

所以此处就是:

当没有传递–stringparam给xsltproc去设置参数的话,

是通过自己写的

E:\Dev_Root\docbook\dev\config\docbook-xsl-ns-1.78.1\webhelp\webhelp_crl.xsl

中的配置,实现覆盖默认配置,达到自己需要的参数的效果的。

转载请注明:在路上 » 【已解决】cygwin中的docbook中使用xsltproc时命令行中通过–stringparam传入的参数无效

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 1.390 seconds, using 22.34MB memory