diff --git a/.gitignore b/.gitignore index cac07840..848f174d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # Mac Finder files .DS_Store +htmlbook-xsl/xspec/xspec/* \ No newline at end of file diff --git a/htmlbook-xsl/chunk.xsl b/htmlbook-xsl/chunk.xsl index fc575802..95a62e16 100755 --- a/htmlbook-xsl/chunk.xsl +++ b/htmlbook-xsl/chunk.xsl @@ -377,8 +377,8 @@ sect5:s - - + + @@ -416,6 +416,7 @@ sect5:s (contains(@data-type, 'footnoteref')) or (contains(@data-type, 'indexterm')))][@href]"> + @@ -432,7 +433,9 @@ sect5:s - + + + @@ -456,8 +459,8 @@ sect5:s - - + + diff --git a/htmlbook-xsl/epub.xsl b/htmlbook-xsl/epub.xsl index acec95ce..ce307efe 100755 --- a/htmlbook-xsl/epub.xsl +++ b/htmlbook-xsl/epub.xsl @@ -141,6 +141,12 @@ + + + + + + diff --git a/htmlbook-xsl/functions-xslt2.xsl b/htmlbook-xsl/functions-xslt2.xsl index 7741f503..1fbbe69b 100644 --- a/htmlbook-xsl/functions-xslt2.xsl +++ b/htmlbook-xsl/functions-xslt2.xsl @@ -3,10 +3,9 @@ xmlns:exsl="http://exslt.org/common" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:htmlbook="https://github.com/oreillymedia/HTMLBook" - xmlns:set="http://exslt.org/sets" xmlns="http://www.w3.org/1999/xhtml" - extension-element-prefixes="exsl set" - exclude-result-prefixes="exsl h set"> + extension-element-prefixes="exsl" + exclude-result-prefixes="exsl h"> @@ -49,7 +48,7 @@ - + diff --git a/htmlbook-xsl/htmlbook.xsl b/htmlbook-xsl/htmlbook.xsl index d66d20f1..48c212ee 100755 --- a/htmlbook-xsl/htmlbook.xsl +++ b/htmlbook-xsl/htmlbook.xsl @@ -19,9 +19,17 @@ - - - + + + + diff --git a/htmlbook-xsl/xspec/bin/xspec.bat b/htmlbook-xsl/xspec/bin/xspec.bat old mode 100755 new mode 100644 index 8fcda6f6..0b4ce63c --- a/htmlbook-xsl/xspec/bin/xspec.bat +++ b/htmlbook-xsl/xspec/bin/xspec.bat @@ -1,95 +1,623 @@ @echo off -SET CP=C:\Program Files (x86)\Oxygen XML Editor\lib\saxon9sa.jar - -SET XSPEC=%1 - -REM ========================================== -REM Check if a parameter was passed -REM ========================================== -IF %XSPEC%x == x GOTO notfound - -REM ========================================== -REM Check if xspec document exists -REM ========================================== -IF NOT EXIST %XSPEC% GOTO notfound -GOTO endif1 - -:notfound -echo File not found. -echo Usage: -echo xspec filename [coverage] -echo filename should specify an XSpec document -echo if coverage is specified, outputs test coverage report -GOTO end -:endif1 - - -SET COVERAGE=%2 - -SET TEST_DIR=%~dp1xspec -SET TARGET_FILE_NAME=%~n1 - -SET TEST_STYLESHEET="%TEST_DIR%\%TARGET_FILE_NAME%.xsl" -SET COVERAGE_XML="%TEST_DIR%\%TARGET_FILE_NAME%-coverage.xml" -SET COVERAGE_HTML="%TEST_DIR%\%TARGET_FILE_NAME%-coverage.html" -SET RESULT="%TEST_DIR%\%TARGET_FILE_NAME%-result.xml" -SET HTML="%TEST_DIR%\%TARGET_FILE_NAME%-result.html" - -REM ================================================ -REM Create xspec subdirectory for running the tests -REM ================================================ -IF NOT EXIST "%TEST_DIR%" GOTO notestdir -GOTO endif2 -:notestdir -echo Creating XSpec Directory at "%TEST_DIR%" ... -mkdir "%TEST_DIR%" -echo. -:endif2 - -echo Creating Test Stylesheet... -echo %TEST_STYLESHEET% -echo %XSPEC% -java -cp "%CP%" net.sf.saxon.Transform -o:%TEST_STYLESHEET% -s:%XSPEC% -xsl:"%~dp0\..\src\compiler\generate-xspec-tests.xsl" -echo. +rem +rem ############################################################################## +rem ## +rem ## This script is used to compile a test suite to XSLT, run it, format +rem ## the report and open it in a browser. +rem ## +rem ## It relies on the environment variable SAXON_HOME to be set to the +rem ## dir Saxon has been installed to (i.e. the containing the Saxon JAR +rem ## file), or on SAXON_CP to be set to a full classpath containing +rem ## Saxon (and maybe more). The latter has precedence over the former. +rem ## +rem ## When running tests for Schematron via XQS, the environment variable +rem ## BASEX_JAR must be set to the BaseX.jar file in a BaseX installation. +rem ## +rem ## It also uses the environment variable XSPEC_HOME. It must be set +rem ## to the XSpec install directory. By default, it uses this script's +rem ## parent dir. +rem ## +rem ## TODO: Not aware of the EXPath Packaging System +rem ## +rem ############################################################################## +rem +rem Comments (rem) +rem Comments starting with '#' are derived from xspec.sh (possibly with +rem some modifications). +rem +rem Environment variables (%FOO%) +rem Environment variables are tried to be on parity with xspec.sh, +rem except that those starting with 'WIN_' are only for this batch +rem file. +rem +rem Labels (:foo) +rem Labels are tried to be on parity with functions in xspec.sh, except +rem that those starting with 'win_' are only for this batch file. +rem + +rem +rem Skip over "utility functions" +rem +goto :win_main_enter + +rem ## +rem ## utility functions ######################################################### +rem ## + +:usage + if not "%~1"=="" ( + call :win_echo %1 + echo: + ) + echo XSpec v%XSPEC_VERSION% + echo: + echo Usage: xspec [-t^|-q^|-s^|-p^|-c^|-j^|-catalog file^|-e^|-h] file + echo: + echo file the XSpec document + echo -t test an XSLT stylesheet (the default) + echo -q test an XQuery module (mutually exclusive with -t, -s, and -p) + echo -s test a Schematron schema (mutually exclusive with -t, -q, and -p) + echo -p test an XProc step (mutually exclusive with -t, -q, and -s) + echo -c output test coverage report (XSLT only) + echo -j output JUnit report + echo -catalog file use XML Catalog file to locate resources + echo -e treat failed tests as error + echo -h display this help message + goto :EOF + +:die + echo: + (echo *** %~1) >&2 + rem + rem Now, to exit the batch file, you must go to :win_main_error_exit from + rem the main code flow. + rem + goto :EOF + +:xslt-with-pipeline + set "PIPELINES=%TEST_DIR%\%TARGET_FILE_NAME%-pipelines.xpl" + rem # Convey XML Calabash configuration file if XMLCALABASH_CONFIG has been set to a URI + set XMLCALABASH_CONFIG_ARG= + if defined XMLCALABASH_CONFIG ( + set XMLCALABASH_CONFIG_ARG=-Dcom.xmlcalabash.configuration="%XMLCALABASH_CONFIG%" + ) + + java -cp "%SAXON_CP%" net.sf.saxon.Transform ^ + -s:"%XSPEC%" ^ + -xsl:"%XSPEC_HOME%\src\compiler\xproc\in-scope-steps\generate-xproc-imports.xsl" ^ + -o:"%PIPELINES%" %CATALOG% + java ^ + -Dxspec.coverage.ignore="%TEST_DIR%" ^ + -Dxspec.coverage.xml="%COVERAGE_XML%" ^ + -Dxspec.home="%XSPEC_HOME%" ^ + -Dxspec.xspecfile="%XSPEC%" ^ + -Dcom.xmlcalabash.pipelines="%PIPELINES%" ^ + %XMLCALABASH_CONFIG_ARG% ^ + -cp "%CP%" net.sf.saxon.Transform ^ + -init:com.xmlcalabash.api.RegisterSaxonFunctions ^ + %CATALOG% %* + goto :EOF + +:xslt + java ^ + -Dxspec.coverage.ignore="%TEST_DIR%" ^ + -Dxspec.coverage.xml="%COVERAGE_XML%" ^ + -Dxspec.home="%XSPEC_HOME%" ^ + -Dxspec.xspecfile="%XSPEC%" ^ + -cp "%CP%" net.sf.saxon.Transform %CATALOG% %* + goto :EOF + +:xquery + java -cp "%CP%" net.sf.saxon.Query %CATALOG% %* + goto :EOF + +:basex + call "%BASEX_JAR%\..\bin\basex.bat" %* + goto :EOF + +:win_reset_options + set XSLT= + set XQUERY= + set SCHEMATRON= + set XPROC= + set COVERAGE= + set JUNIT= + set WIN_HELP= + set WIN_UNKNOWN_OPTION= + set WIN_EXTRA_OPTION= + set XSPEC= + set CATALOG= + set BASEX_CATALOG= + set REPORT_THEME=default + set ERROR_ON_TEST_FAILURE= + goto :EOF + +:win_get_options + set "WIN_ARGV=%~1" + + if not defined WIN_ARGV ( + goto :EOF + ) else if "%WIN_ARGV%"=="-t" ( + set XSLT=1 + ) else if "%WIN_ARGV%"=="-q" ( + set XQUERY=1 + ) else if "%WIN_ARGV%"=="-s" ( + set SCHEMATRON=1 + ) else if "%WIN_ARGV%"=="-p" ( + set XPROC=1 + ) else if "%WIN_ARGV%"=="-c" ( + set COVERAGE=1 + ) else if "%WIN_ARGV%"=="-j" ( + set JUNIT=1 + ) else if "%WIN_ARGV%"=="-e" ( + set ERROR_ON_TEST_FAILURE=1 + ) else if "%WIN_ARGV%"=="-h" ( + set WIN_HELP=1 + ) else if "%WIN_ARGV%"=="-catalog" ( + set "XML_CATALOG=%~2" + shift + ) else if "%WIN_ARGV:~0,1%"=="-" ( + set "WIN_UNKNOWN_OPTION=%WIN_ARGV%" + ) else if defined XSPEC ( + set "WIN_EXTRA_OPTION=%WIN_ARGV%" + goto :EOF + ) else ( + set "XSPEC=%WIN_ARGV%" + ) + + shift + goto :win_get_options + +:classify_and_process_schematron + rem # Set QUERYLANGUAGE variable to stylesheet output, which should be xslt or xquery + FOR /F "delims=" %%V IN ('java -cp "%SAXON_CP%" net.sf.saxon.Transform -s:"%XSPEC%" -xsl:"%XSPEC_HOME%\src\schematron\get-query-binding.xsl" -it %CATALOG%') DO SET "QUERYLANGUAGE=%%V" + if "%QUERYLANGUAGE%"=="xquery" ( + call :preprocess_schematron-xqs + set XSLT= + set XQUERY=1 + ) else ( + call :preprocess_schematron + ) + goto :EOF + +:preprocess_schematron-xqs + set "SCH_PREPROCESSED_XSPEC=%TEST_DIR%\%TARGET_FILE_NAME%-sch-preprocessed.xspec" + if not defined XQS_HOME_URI set "XQS_HOME_URI=../../lib/XQS/" + echo: + echo Converting Schematron XSpec into XQuery XSpec... + call :xslt -o:"%SCH_PREPROCESSED_XSPEC%" ^ + -s:"%XSPEC%" ^ + -xsl:"%XSPEC_HOME%\src\schematron\schut-to-xspec.xsl" ^ + stylesheet-uri="irrelevant for XQS but make it nonempty" ^ + sch-impl-name="xqs" ^ + xqs-home="%XQS_HOME_URI%" ^ + || ( call :die "Error converting Schematron XSpec into XQuery XSpec" & goto :win_main_error_exit ) + set "XSPEC=%SCH_PREPROCESSED_XSPEC%" + echo: + goto :EOF + +:preprocess_schematron + set "SCH_PREPROCESSED_XSPEC=%TEST_DIR%\%TARGET_FILE_NAME%-sch-preprocessed.xspec" + set "SCH_PREPROCESSED_XSL=%TEST_DIR%\%TARGET_FILE_NAME%-sch-preprocessed.xsl" + + set SCHUT_TO_XSLT_PARAMS= + if defined SCHEMATRON_XSLT_INCLUDE ( + if "%SCHEMATRON_XSLT_INCLUDE%"=="#none" ( + set SCHUT_TO_XSLT_PARAMS=%SCHUT_TO_XSLT_PARAMS% STEP1-PREPROCESSOR-URI="%SCHEMATRON_XSLT_INCLUDE%" + ) else ( + set SCHUT_TO_XSLT_PARAMS=%SCHUT_TO_XSLT_PARAMS% +STEP1-PREPROCESSOR-DOC="%SCHEMATRON_XSLT_INCLUDE%" + ) + ) + if defined SCHEMATRON_XSLT_EXPAND ( + if "%SCHEMATRON_XSLT_EXPAND%"=="#none" ( + set SCHUT_TO_XSLT_PARAMS=%SCHUT_TO_XSLT_PARAMS% STEP2-PREPROCESSOR-URI="%SCHEMATRON_XSLT_EXPAND%" + ) else ( + set SCHUT_TO_XSLT_PARAMS=%SCHUT_TO_XSLT_PARAMS% +STEP2-PREPROCESSOR-DOC="%SCHEMATRON_XSLT_EXPAND%" + ) + ) + if defined SCHEMATRON_XSLT_COMPILE set SCHUT_TO_XSLT_PARAMS=%SCHUT_TO_XSLT_PARAMS% +STEP3-PREPROCESSOR-DOC="%SCHEMATRON_XSLT_COMPILE%" + + echo: + echo Converting Schematron into XSLT... + call :xslt ^ + -o:"%SCH_PREPROCESSED_XSL%" ^ + -s:"%XSPEC%" ^ + -xsl:"%XSPEC_HOME%\src\schematron\schut-to-xslt.xsl" ^ + %SCHUT_TO_XSLT_PARAMS% ^ + || ( call :die "Error converting Schematron into XSLT" & goto :win_main_error_exit ) + + echo: + echo Converting Schematron XSpec into XSLT XSpec... + call :xslt -o:"%SCH_PREPROCESSED_XSPEC%" ^ + -s:"%XSPEC%" ^ + -xsl:"%XSPEC_HOME%\src\schematron\schut-to-xspec.xsl" ^ + +stylesheet-doc="%SCH_PREPROCESSED_XSL%" ^ + || ( call :die "Error converting Schematron XSpec into XSLT XSpec" & goto :win_main_error_exit ) + set "XSPEC=%SCH_PREPROCESSED_XSPEC%" + echo: + goto :EOF + +:win_echo + rem + rem Prints a message removing its surrounding quotes (") + rem + set "WIN_ECHO_LINE=%~1" + setlocal enabledelayedexpansion + echo !WIN_ECHO_LINE! + goto :EOF + +rem +rem Main ######################################################################### +rem +:win_main_enter + +rem +rem Begin localization of environment changes. +rem Also make sure the command processor extensions are enabled. +rem +verify other 2> NUL +setlocal enableextensions +if errorlevel 1 ( + echo Unable to enable extensions + exit /b %ERRORLEVEL% +) + +rem +rem ## +rem ## some variables ############################################################ +rem ## +rem + +rem +rem # the command to use to open the final HTML report +rem +rem Include the command line options (and consequently the double quotes) +rem if necessary. +rem +rem set OPEN=start "XSpec Report" + +rem +rem # set XSPEC_HOME if it has not been set by the user (set it to the +rem # parent dir of this script) +rem +if not defined XSPEC_HOME set "XSPEC_HOME=%~dp0.." + +rem +rem # safety checks +rem +for %%I in ("%XSPEC_HOME%") do echo "%%~aI" | "%SYSTEMROOT%\system32\find" "d" > NUL +if errorlevel 1 ( + call :win_echo "ERROR: XSPEC_HOME is not a directory: %XSPEC_HOME%" + exit /b 1 +) + +set XSPEC_VERSION= +set /p XSPEC_VERSION=<"%XSPEC_HOME%\src\common\VERSION" +if not defined XSPEC_VERSION ( + call :win_echo "ERROR: XSPEC_HOME seems to be corrupted: %XSPEC_HOME%" + exit /b 1 +) + +rem +rem # set SAXON_CP (either it has been by the user, or set it from SAXON_HOME) +rem + +set USE_SAXON_HOME= + +if not defined SAXON_CP ( + if not defined SAXON_HOME ( + echo SAXON_CP and SAXON_HOME both not set! + ) else ( + set USE_SAXON_HOME=1 + for %%I in ( + "%SAXON_HOME%\saxon9?e.jar" + "%SAXON_HOME%\saxon-?e-??.?*.jar" + ) do set "SAXON_CP=%%~I" + ) +) + +if defined USE_SAXON_HOME ( + if not defined SAXON_CP ( + call :win_echo "Saxon jar cannot be found in SAXON_HOME: %SAXON_HOME%" + ) else ( + if exist "%SAXON_HOME%\xml-resolver-1.2.jar" ( + set "SAXON_CP=%SAXON_CP%;%SAXON_HOME%\xml-resolver-1.2.jar" + ) + ) +) + +set "CP=%SAXON_CP%;%XSPEC_HOME%\java" + +rem +rem ## +rem ## options ################################################################### +rem ## +rem + +rem +rem Parse command line +rem +call :win_reset_options +call :win_get_options %* + +rem +rem # Schematron +rem # XSLT +rem +if defined SCHEMATRON if defined XSLT ( + call :usage "-s and -t are mutually exclusive" + exit /b 1 +) + +rem +rem # Schematron +rem # XQuery +rem +if defined SCHEMATRON if defined XQUERY ( + call :usage "-s and -q are mutually exclusive" + exit /b 1 +) + +rem +rem # XSLT +rem # XQuery +rem +if defined XSLT if defined XQUERY ( + call :usage "-t and -q are mutually exclusive" + exit /b 1 +) + +rem +rem # XProc +rem # XSLT +rem +if defined XPROC if defined XSLT ( + call :usage "-p and -t are mutually exclusive" + exit /b 1 +) + +rem +rem # XProc +rem # XQuery +rem +if defined XPROC if defined XQUERY ( + call :usage "-p and -q are mutually exclusive" + exit /b 1 +) + +rem +rem # XProc +rem # Schematron +rem +if defined XPROC if defined SCHEMATRON ( + call :usage "-p and -s are mutually exclusive" + exit /b 1 +) + +rem +rem # Help! +rem +if defined WIN_HELP ( + call :usage + exit /b 0 +) + +rem +rem # Unknown option! +rem +if defined WIN_UNKNOWN_OPTION ( + call :usage "Error: Unknown option: %WIN_UNKNOWN_OPTION%" + exit /b 1 +) + +rem +rem # Coverage is only for XSLT +rem +if defined COVERAGE if not ""=="%XQUERY%%SCHEMATRON%%XPROC%" ( + call :usage "Coverage is supported only for XSLT" + exit /b 1 +) + +rem +rem # set CATALOG option for Saxon and BaseX if XML_CATALOG has been set +rem +if defined XML_CATALOG ( + set CATALOG=-catalog:"%XML_CATALOG%" + set BASEX_CATALOG=-OCATALOG="%XML_CATALOG%" -ODTD=true +) + +rem +rem # set XSLT if XQuery and XProc have not been set (XSLT is the default) +rem +if not defined XSLT if not defined XQUERY if not defined XPROC set XSLT=1 + +if not exist "%XSPEC%" ( + call :usage "Error: File not found." + exit /b 1 +) + +rem +rem Extra option +rem +if defined WIN_EXTRA_OPTION ( + call :usage "Error: Extra option: %WIN_EXTRA_OPTION%" + exit /b 1 +) + +rem + +rem +rem ## +rem ## files and dirs ############################################################ +rem ## +rem + +rem # TEST_DIR (may be relative, may not exist) +if not defined TEST_DIR for %%I in ("%XSPEC%") do set "TEST_DIR=%%~dpIxspec" + +for %%I in ("%XSPEC%") do set "TARGET_FILE_NAME=%%~nI" + +set "COVERAGE_XML=%TEST_DIR%\%TARGET_FILE_NAME%-coverage.xml" +if not defined COVERAGE_HTML set "COVERAGE_HTML=%TEST_DIR%\%TARGET_FILE_NAME%-coverage.html" +set "RESULT=%TEST_DIR%\%TARGET_FILE_NAME%-result.xml" +set "HTML=%TEST_DIR%\%TARGET_FILE_NAME%-result.html" +set "JUNIT_RESULT=%TEST_DIR%\%TARGET_FILE_NAME%-junit.xml" +set COVERAGE_CLASS=com.jenitennison.xslt.tests.XSLTCoverageTraceListener + +if not exist "%TEST_DIR%" ( + call :win_echo "Creating XSpec Directory at %TEST_DIR%..." + mkdir "%TEST_DIR%" + echo: +) + +if defined SCHEMATRON call :classify_and_process_schematron || goto :win_main_error_exit + +rem Forward slash in COMPILED is deliberate; see https://github.com/xspec/xspec/issues/2246#issuecomment-3783402532 +set "COMPILED=%TEST_DIR%/%TARGET_FILE_NAME%-compiled" +if defined XQUERY ( + set "COMPILED=%COMPILED%.xq" +) else ( + set "COMPILED=%COMPILED%.xsl" +) + +rem +rem ## +rem ## compile the suite ######################################################### +rem ## +rem + +if defined XSLT ( + set COMPILE_SHEET=compile-xslt-tests.xsl +) else if defined XPROC ( + set COMPILE_SHEET=compile-xproc-tests.xsl +) else ( + set COMPILE_SHEET=compile-xquery-tests.xsl +) +echo Creating Test Runner... +call :xslt -o:"%COMPILED%" -s:"%XSPEC%" ^ + -xsl:"%XSPEC_HOME%\src\compiler\%COMPILE_SHEET%" ^ + || ( call :die "Error compiling the test suite" & goto :win_main_error_exit ) +echo: + +rem +rem ## +rem ## run the suite ############################################################# +rem ## +rem echo Running Tests... +if defined XSLT ( + rem + rem # for XSLT or XSLT-based Schematron + rem + if defined COVERAGE ( + echo Collecting test coverage data... + call :xslt %SAXON_CUSTOM_OPTIONS% ^ + -T:%COVERAGE_CLASS% ^ + -o:"%RESULT%" -xsl:"%COMPILED%" ^ + -it:{http://www.jenitennison.com/xslt/xspec}main ^ + || ( call :die "Error collecting test coverage data" & goto :win_main_error_exit ) + ) else ( + call :xslt %SAXON_CUSTOM_OPTIONS% ^ + -o:"%RESULT%" -xsl:"%COMPILED%" ^ + -it:{http://www.jenitennison.com/xslt/xspec}main ^ + || ( call :die "Error running the test suite" & goto :win_main_error_exit ) + ) +) else if defined SCHEMATRON ( + rem + rem # for Schematron via XQS + rem + if defined BASEX_JAR ( + call :basex %BASEX_CATALOG% -Q"%COMPILED%" > "%RESULT%" ^ + || ( call :die "Error running the test suite" & goto :win_main_error_exit ) + ) else ( + call :die "Executing test for Schematron with XQS requires BASEX_JAR to be defined" & goto :win_main_error_exit + ) +) else if defined XPROC ( + rem + rem # for XProc + rem + call :xslt-with-pipeline %SAXON_CUSTOM_OPTIONS% ^ + -o:"%RESULT%" -xsl:"%COMPILED%" ^ + -it:{http://www.jenitennison.com/xslt/xspec}main ^ + || ( call :die "Error running the test suite" & goto :win_main_error_exit ) +) else ( + rem + rem # for XQuery + rem + call :xquery %SAXON_CUSTOM_OPTIONS% ^ + -o:"%RESULT%" -q:"%COMPILED%" ^ + || ( call :die "Error running the test suite" & goto :win_main_error_exit ) + ) +) + +rem +rem ## +rem ## format the report ######################################################### +rem ## +rem -REM ======================================= -REM Check if coverage parameter was passed -REM ======================================= -IF %COVERAGE%x == coveragex GOTO coverage -GOTO endif3 -:coverage -echo Collecting test coverage data; suppressing progress report... - java -cp "%CP%" net.sf.saxon.Transform -T:com.jenitennison.xslt.tests.XSLTCoverageTraceListener \ - -o:%RESULT% -s:%XSPEC% -xsl:%TEST_STYLESHEET% -it:{http://www.jenitennison.com/xslt/xspec}main 2> %COVERAGE_XML% - -:endif3 - -REM ======================================= -REM Run the tests -REM ======================================= -java -cp "%CP%" net.sf.saxon.Transform -o:%RESULT% -s:%XSPEC% -xsl:%TEST_STYLESHEET% -it:{http://www.jenitennison.com/xslt/xspec}main - -echo. +if not defined HTML_REPORTER_XSL set "HTML_REPORTER_XSL=%XSPEC_HOME%\src\reporter\format-xspec-report.xsl" +if not defined COVERAGE_REPORTER_XSL set "COVERAGE_REPORTER_XSL=%XSPEC_HOME%\src\reporter\coverage-report.xsl" +if defined XSPEC_HTML_REPORT_THEME set "REPORT_THEME=%XSPEC_HTML_REPORT_THEME%" + +echo: echo Formatting Report... -java -cp "%CP%" net.sf.saxon.Transform -o:%HTML% -s:%RESULT% -xsl:"%~dp0\..\src\reporter\format-xspec-report.xsl" - -REM ======================================= -REM Check if coverage parameter was passed -REM ======================================= -IF %COVERAGE%x == coveragex GOTO coverage2 -GOTO endif4 -:coverage2 - java -cp "%CP%" net.sf.saxon.Transform -l:on -o:%COVERAGE_HTML% -s:%COVERAGE_XML% -xsl:"%~dp0\..\src\reporter\coverage-report.xsl" "tests=%XSPEC%" - %COVERAGE_HTML% -:endif4 - -REM ============= -REM Output report -REM ============= -%HTML% +call :xslt -o:"%HTML%" ^ + -s:"%RESULT%" ^ + -xsl:"%HTML_REPORTER_XSL%" ^ + inline-css=true ^ + report-theme=%REPORT_THEME% ^ + || ( call :die "Error formatting the report" & goto :win_main_error_exit ) + +if defined COVERAGE ( + echo: + echo Formatting Coverage Report... + call :xslt -config:"%XSPEC_HOME%\src\reporter\coverage-report-config.xml" ^ + -o:"%COVERAGE_HTML%" ^ + -s:"%COVERAGE_XML%" ^ + -xsl:"%COVERAGE_REPORTER_XSL%" ^ + inline-css=true ^ + report-theme=%REPORT_THEME% ^ + || ( call :die "Error formatting the coverage report" & goto :win_main_error_exit ) + call :win_echo "Report available at %COVERAGE_HTML%" + rem %OPEN% "%COVERAGE_HTML%" +) else if defined JUNIT ( + echo: + echo Generating JUnit Report... + call :xslt -o:"%JUNIT_RESULT%" ^ + -s:"%RESULT%" ^ + -xsl:"%XSPEC_HOME%\src\reporter\junit-report.xsl" ^ + || ( call :die "Error formatting the JUnit report" & goto :win_main_error_exit ) + call :win_echo "Report available at %JUNIT_RESULT%" +) else ( + call :win_echo "Report available at %HTML%" + rem %OPEN% "%HTML%" +) + +rem +rem ## +rem ## error on test failure ##################################################### +rem ## +rem + +if defined ERROR_ON_TEST_FAILURE ( + call :xslt ^ + -s:"%RESULT%" ^ + -xsl:"%XSPEC_HOME%\src\cli\terminate-on-test-failure.xsl" 2> NUL ^ + || ( call :die "Found a test failure" & goto :win_main_error_exit ) +) echo Done. -:end +exit /b + +rem +rem Error exit ################################################################### +rem +:win_main_error_exit +if errorlevel 1 ( + exit /b %ERRORLEVEL% +) else ( + exit /b 1 +) diff --git a/htmlbook-xsl/xspec/bin/xspec.sh b/htmlbook-xsl/xspec/bin/xspec.sh index 37f7cf5c..812fa083 100755 --- a/htmlbook-xsl/xspec/bin/xspec.sh +++ b/htmlbook-xsl/xspec/bin/xspec.sh @@ -10,21 +10,13 @@ ## file), or on $SAXON_CP to be set to a full classpath containing ## Saxon (and maybe more). The latter has precedence over the former. ## +## When running tests for Schematron via XQS, the environment variable +## BASEX_JAR must be set to the BaseX.jar file in a BaseX installation. +## ## It also uses the environment variable XSPEC_HOME. It must be set ## to the XSpec install directory. By default, it uses this script's ## parent dir. ## -## Note: If you use the EXPath Packaging System with Saxon, then you -## already have the script "saxon" shipped with expath-repo. In that -## case you don't need to do anything, this script will be detected -## and used instead. You just have to ensure it is visible from here -## (aka "ensure it is in the $PATH"). Even without packaging support, -## this script is a useful way to launch Saxon from the shell. -## -## TODO: With the Packaging System, there should be no need to set the -## XSPEC_HOME, as we could use absolute public URIs for the public -## components... -## ############################################################################## ## @@ -36,15 +28,19 @@ usage() { echo "$1" echo fi - echo "Usage: xspec [-t|-q|-s|-c|-j|-catalog file|-h] file" + echo "XSpec v${XSPEC_VERSION}" + echo + echo "Usage: xspec [-t|-q|-s|-p|-c|-j|-catalog file|-e|-h] file" echo echo " file the XSpec document" echo " -t test an XSLT stylesheet (the default)" - echo " -q test an XQuery module (mutually exclusive with -t and -s)" - echo " -s test a Schematron schema (mutually exclusive with -t and -q)" + echo " -q test an XQuery module (mutually exclusive with -t, -s, and -p)" + echo " -s test a Schematron schema (mutually exclusive with -t, -q, and -p)" + echo " -p test an XProc step (mutually exclusive with -t, -q, and -s)" echo " -c output test coverage report (XSLT only)" echo " -j output JUnit report" echo " -catalog file use XML Catalog file to locate resources" + echo " -e treat failed tests as error" echo " -h display this help message" } @@ -54,47 +50,120 @@ die() { exit 1 } -# If there is a script called "saxon" and returning ok (status code 0) -# when called with "--help", we assume this is the EXPath Packaging -# script for Saxon [1]. If it is present, that means the user already -# configured it, so there is no point to duplicate the logic here. -# Just use it. +xslt-with-pipeline() { + PIPELINES="${TEST_DIR}/${TARGET_FILE_NAME}-pipelines.xpl" + # Convey XML Calabash configuration file if XMLCALABASH_CONFIG has been set to a URI + if test -n "$XMLCALABASH_CONFIG"; then + XMLCALABASH_CONFIG_ARG="-Dcom.xmlcalabash.configuration=$XMLCALABASH_CONFIG" + else + XMLCALABASH_CONFIG_ARG= + fi + + xslt \ + -s:"$XSPEC" \ + -xsl:"$XSPEC_HOME/src/compiler/xproc/in-scope-steps/generate-xproc-imports.xsl" \ + -o:"${PIPELINES}" + java \ + -Dxspec.coverage.ignore="${TEST_DIR}" \ + -Dxspec.coverage.xml="${COVERAGE_XML}" \ + -Dxspec.home="${XSPEC_HOME}" \ + -Dxspec.xspecfile="${XSPEC}" \ + -Dcom.xmlcalabash.pipelines="${PIPELINES}" \ + ${XMLCALABASH_CONFIG_ARG:+"$XMLCALABASH_CONFIG_ARG"} \ + -cp "$CP" net.sf.saxon.Transform \ + -init:com.xmlcalabash.api.RegisterSaxonFunctions \ + ${CATALOG:+"$CATALOG"} "$@" +} +xslt() { + java \ + -Dxspec.coverage.ignore="${TEST_DIR}" \ + -Dxspec.coverage.xml="${COVERAGE_XML}" \ + -Dxspec.home="${XSPEC_HOME}" \ + -Dxspec.xspecfile="${XSPEC}" \ + -cp "$CP" net.sf.saxon.Transform ${CATALOG:+"$CATALOG"} "$@" +} +xquery() { + java -cp "$CP" net.sf.saxon.Query ${CATALOG:+"$CATALOG"} "$@" +} + +basex() { + # BaseX dir + basex_home=$(dirname -- "${BASEX_JAR}") + "${basex_home}/bin/basex" "$@" +} -if command -v saxon > /dev/null 2>&1 && saxon --help | grep "EXPath Packaging" > /dev/null 2>&1; then - echo Saxon script found, use it. +classify_and_process_schematron() { + # stylesheet output should be xslt or xquery + if xslt -s:"$XSPEC" -xsl:"$XSPEC_HOME/src/schematron/get-query-binding.xsl" -it | grep "xquery" > /dev/null 2>&1; then + preprocess_schematron-xqs + XSLT= + else + preprocess_schematron + fi +} + +preprocess_schematron-xqs() { + SCH_PREPROCESSED_XSPEC="${TEST_DIR}/${TARGET_FILE_NAME}-sch-preprocessed.xspec" + if test -z "${XQS_HOME_URI}"; then + XQS_HOME_URI="../../lib/XQS/" + fi echo - xslt() { - saxon \ - --java -Dxspec.coverage.ignore="${TEST_DIR}" \ - --java -Dxspec.coverage.xml="${COVERAGE_XML}" \ - --java -Dxspec.xspecfile="${XSPEC}" \ - --add-cp "${XSPEC_HOME}/java/" ${CATALOG:+"$CATALOG"} --xsl "$@" - } - xquery() { - saxon \ - --java -Dxspec.coverage.ignore="${TEST_DIR}" \ - --java -Dxspec.coverage.xml="${COVERAGE_XML}" \ - --java -Dxspec.xspecfile="${XSPEC}" \ - --add-cp "${XSPEC_HOME}/java/" ${CATALOG:+"$CATALOG"} --xq "$@" - } -else - echo Saxon script not found, invoking JVM directly instead. + echo "Converting Schematron XSpec into XQuery XSpec..." + xslt -o:"${SCH_PREPROCESSED_XSPEC}" \ + -s:"${XSPEC}" \ + -xsl:"${XSPEC_HOME}/src/schematron/schut-to-xspec.xsl" \ + stylesheet-uri="irrelevant for XQS but make it nonempty" \ + sch-impl-name="xqs" \ + xqs-home="${XQS_HOME_URI}" \ + || die "Error converting Schematron XSpec into XQuery XSpec" + XSPEC="${SCH_PREPROCESSED_XSPEC}" + echo - xslt() { - java \ - -Dxspec.coverage.ignore="${TEST_DIR}" \ - -Dxspec.coverage.xml="${COVERAGE_XML}" \ - -Dxspec.xspecfile="${XSPEC}" \ - -cp "$CP" net.sf.saxon.Transform ${CATALOG:+"$CATALOG"} "$@" - } - xquery() { - java \ - -Dxspec.coverage.ignore="${TEST_DIR}" \ - -Dxspec.coverage.xml="${COVERAGE_XML}" \ - -Dxspec.xspecfile="${XSPEC}" \ - -cp "$CP" net.sf.saxon.Query ${CATALOG:+"$CATALOG"} "$@" - } -fi +} + +preprocess_schematron() { + SCH_PREPROCESSED_XSPEC="${TEST_DIR}/${TARGET_FILE_NAME}-sch-preprocessed.xspec" + SCH_PREPROCESSED_XSL="${TEST_DIR}/${TARGET_FILE_NAME}-sch-preprocessed.xsl" + + SCHUT_TO_XSLT_PARAMS=() + if [ -n "${SCHEMATRON_XSLT_INCLUDE}" ]; then + if [ "${SCHEMATRON_XSLT_INCLUDE}" = "#none" ]; then + SCHUT_TO_XSLT_PARAMS+=("STEP1-PREPROCESSOR-URI=${SCHEMATRON_XSLT_INCLUDE}") + else + SCHUT_TO_XSLT_PARAMS+=("+STEP1-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_INCLUDE}") + fi + fi + if [ -n "${SCHEMATRON_XSLT_EXPAND}" ]; then + if [ "${SCHEMATRON_XSLT_EXPAND}" = "#none" ]; then + SCHUT_TO_XSLT_PARAMS+=("STEP2-PREPROCESSOR-URI=${SCHEMATRON_XSLT_EXPAND}") + else + SCHUT_TO_XSLT_PARAMS+=("+STEP2-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_EXPAND}") + fi + fi + if [ -n "${SCHEMATRON_XSLT_COMPILE}" ]; then + SCHUT_TO_XSLT_PARAMS+=("+STEP3-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_COMPILE}") + fi + + echo + echo "Converting Schematron into XSLT..." + xslt \ + -o:"${SCH_PREPROCESSED_XSL}" \ + -s:"${XSPEC}" \ + -xsl:"${XSPEC_HOME}/src/schematron/schut-to-xslt.xsl" \ + "${SCHUT_TO_XSLT_PARAMS[@]}" \ + || die "Error converting Schematron into XSLT" + + echo + echo "Converting Schematron XSpec into XSLT XSpec..." + xslt -o:"${SCH_PREPROCESSED_XSPEC}" \ + -s:"${XSPEC}" \ + -xsl:"${XSPEC_HOME}/src/schematron/schut-to-xspec.xsl" \ + +stylesheet-doc="${SCH_PREPROCESSED_XSL}" \ + || die "Error converting Schematron XSpec into XSLT XSpec" + XSPEC="${SCH_PREPROCESSED_XSPEC}" + + echo +} ## ## some variables ############################################################ @@ -107,8 +176,8 @@ fi # OPEN=see #fi -# the classpath delimiter (aka ':', except ';' on Cygwin) -if uname | grep -i cygwin > /dev/null 2>&1; then +# the classpath delimiter (aka ':', except ';' on Cygwin and MSYS) +if uname | grep -i 'cygwin\|msys' > /dev/null 2>&1; then CP_DELIM=";" else CP_DELIM=":" @@ -117,7 +186,7 @@ fi # set XSPEC_HOME if it has not been set by the user (set it to the # parent dir of this script) if test -z "$XSPEC_HOME"; then - XSPEC_HOME=$(dirname "$0") + XSPEC_HOME="$(cd "$(dirname "$0")" && pwd)" XSPEC_HOME=$(dirname "$XSPEC_HOME") fi # safety checks @@ -125,7 +194,9 @@ if test \! -d "${XSPEC_HOME}"; then echo "ERROR: XSPEC_HOME is not a directory: ${XSPEC_HOME}" exit 1 fi -if test \! -f "${XSPEC_HOME}/src/compiler/generate-common-tests.xsl"; then +unset XSPEC_VERSION +XSPEC_VERSION=$(cat "${XSPEC_HOME}/src/common/VERSION") +if [ -z "${XSPEC_VERSION}" ]; then echo "ERROR: XSPEC_HOME seems to be corrupted: ${XSPEC_HOME}" exit 1 fi @@ -165,7 +236,8 @@ CP="${SAXON_CP}${CP_DELIM}${XSPEC_HOME}/java/" ## options ################################################################### ## -while echo "$1" | grep -- ^- > /dev/null 2>&1; do +# Use printf instead of echo: https://stackoverflow.com/a/3657061/11853330 +while printf "%s\n" "$1" | grep -- ^- > /dev/null 2>&1; do case "$1" in # XSLT -t) @@ -177,6 +249,10 @@ while echo "$1" | grep -- ^- > /dev/null 2>&1; do usage "-s and -t are mutually exclusive" exit 1 fi + if test -n "$XPROC"; then + usage "-p and -t are mutually exclusive" + exit 1 + fi XSLT=1 ;; # XQuery @@ -189,6 +265,10 @@ while echo "$1" | grep -- ^- > /dev/null 2>&1; do usage "-s and -q are mutually exclusive" exit 1 fi + if test -n "$XPROC"; then + usage "-p and -q are mutually exclusive" + exit 1 + fi XQUERY=1 ;; # Schematron @@ -201,9 +281,29 @@ while echo "$1" | grep -- ^- > /dev/null 2>&1; do usage "-s and -t are mutually exclusive" exit 1 fi + if test -n "$XPROC"; then + usage "-p and -s are mutually exclusive" + exit 1 + fi SCHEMATRON=1 ;; - # Coverage + # XProc + -p) + if test -n "$XQUERY"; then + usage "-p and -q are mutually exclusive" + exit 1 + fi + if test -n "$XSLT"; then + usage "-p and -t are mutually exclusive" + exit 1 + fi + if test -n "$SCHEMATRON"; then + usage "-p and -s are mutually exclusive" + exit 1 + fi + XPROC=1 + ;; + # Coverage -c) COVERAGE=1 ;; @@ -216,6 +316,10 @@ while echo "$1" | grep -- ^- > /dev/null 2>&1; do shift XML_CATALOG="$1" ;; + # Error on test failure + -e) + ERROR_ON_TEST_FAILURE=1 + ;; # Help! -h) usage @@ -231,7 +335,7 @@ while echo "$1" | grep -- ^- > /dev/null 2>&1; do done # Coverage is only for XSLT -if [ -n "${COVERAGE}" ] && [ -n "${XQUERY}${SCHEMATRON}" ]; then +if [ -n "${COVERAGE}" ] && [ -n "${XQUERY}${SCHEMATRON}${XPROC}" ]; then usage "Coverage is supported only for XSLT" exit 1 fi @@ -243,8 +347,8 @@ else CATALOG= fi -# set XSLT if XQuery has not been set (that's the default) -if test -z "$XQUERY"; then +# set XSLT if XQuery and XProc have not been set (XSLT is the default) +if [ -z "$XQUERY" ] && [ -z "$XPROC" ]; then XSLT=1 fi @@ -270,12 +374,6 @@ fi TARGET_FILE_NAME=$(basename "$XSPEC" | sed 's:\.[^.]*$::') -COMPILED="${TEST_DIR}/${TARGET_FILE_NAME}-compiled" -if test -n "$XSLT"; then - COMPILED="${COMPILED}.xsl" -else - COMPILED="${COMPILED}.xq" -fi COVERAGE_XML=$TEST_DIR/$TARGET_FILE_NAME-coverage.xml if [ -z "${COVERAGE_HTML}" ]; then COVERAGE_HTML="${TEST_DIR}/${TARGET_FILE_NAME}-coverage.html" @@ -291,52 +389,31 @@ if [ ! -d "$TEST_DIR" ]; then echo fi -## -## compile the suite ######################################################### -## - if test -n "$SCHEMATRON"; then - SCH_PREPROCESSED_XSPEC="${TEST_DIR}/${TARGET_FILE_NAME}-sch-preprocessed.xspec" - SCH_PREPROCESSED_XSL="${TEST_DIR}/${TARGET_FILE_NAME}-sch-preprocessed.xsl" - - SCHUT_TO_XSLT_PARAMS=() - if [ -n "${SCHEMATRON_XSLT_INCLUDE}" ]; then - SCHUT_TO_XSLT_PARAMS+=("+STEP1-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_INCLUDE}") - fi - if [ -n "${SCHEMATRON_XSLT_EXPAND}" ]; then - SCHUT_TO_XSLT_PARAMS+=("+STEP2-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_EXPAND}") - fi - if [ -n "${SCHEMATRON_XSLT_COMPILE}" ]; then - SCHUT_TO_XSLT_PARAMS+=("+STEP3-PREPROCESSOR-DOC=${SCHEMATRON_XSLT_COMPILE}") - fi - - echo - echo "Converting Schematron into XSLT..." - xslt \ - -o:"${SCH_PREPROCESSED_XSL}" \ - -s:"${XSPEC}" \ - -xsl:"${XSPEC_HOME}/src/schematron/schut-to-xslt.xsl" \ - "${SCHUT_TO_XSLT_PARAMS[@]}" \ - || die "Error converting Schematron into XSLT" - - echo - echo "Converting Schematron XSpec into XSLT XSpec..." - xslt -o:"${SCH_PREPROCESSED_XSPEC}" \ - -s:"${XSPEC}" \ - -xsl:"${XSPEC_HOME}/src/schematron/schut-to-xspec.xsl" \ - +stylesheet-doc="${SCH_PREPROCESSED_XSL}" \ - || die "Error converting Schematron XSpec into XSLT XSpec" - XSPEC="${SCH_PREPROCESSED_XSPEC}" + classify_and_process_schematron +fi - echo +COMPILED="${TEST_DIR}/${TARGET_FILE_NAME}-compiled" +if test -n "$XQUERY"; then + COMPILED="${COMPILED}.xq" +else + COMPILED="${COMPILED}.xsl" fi +## +## compile the suite ######################################################### +## + if test -n "$XSLT"; then - COMPILE_SHEET=generate-xspec-tests.xsl + COMPILE_SHEET=compile-xslt-tests.xsl else - COMPILE_SHEET=generate-query-tests.xsl + if test -n "$XPROC"; then + COMPILE_SHEET=compile-xproc-tests.xsl + else + COMPILE_SHEET=compile-xquery-tests.xsl + fi fi -echo "Creating Test Stylesheet..." +echo "Creating Test Runner..." xslt -o:"$COMPILED" -s:"$XSPEC" \ -xsl:"$XSPEC_HOME/src/compiler/$COMPILE_SHEET" \ || die "Error compiling the test suite" @@ -355,7 +432,7 @@ declare -a "saxon_custom_options_array=(${SAXON_CUSTOM_OPTIONS})" echo "Running Tests..." if test -n "$XSLT"; then - # for XSLT + # for XSLT or XSLT-based Schematron if test -n "$COVERAGE"; then echo "Collecting test coverage data..." xslt "${saxon_custom_options_array[@]}" \ @@ -370,17 +447,32 @@ if test -n "$XSLT"; then || die "Error running the test suite" fi else - # for XQuery - if test -n "$COVERAGE"; then - echo "Collecting test coverage data..." - xquery "${saxon_custom_options_array[@]}" \ - -T:$COVERAGE_CLASS \ - -o:"$RESULT" -q:"$COMPILED" \ - || die "Error collecting test coverage data" + if test -n "$SCHEMATRON"; then + # for Schematron via XQS + if test -n "$BASEX_JAR"; then + if test -n "$XML_CATALOG"; then + basex -OCATALOG="$XML_CATALOG" -ODTD=true -Q"$COMPILED" > "$RESULT" \ + || die "Error running the test suite" + else + basex -Q"$COMPILED" > "$RESULT" \ + || die "Error running the test suite" + fi + else + die "Executing test for Schematron with XQS requires BASEX_JAR to be defined" + fi else - xquery "${saxon_custom_options_array[@]}" \ - -o:"$RESULT" -q:"$COMPILED" \ - || die "Error running the test suite" + if test -n "$XPROC"; then + # For XProc + xslt-with-pipeline "${saxon_custom_options_array[@]}" \ + -o:"$RESULT" -xsl:"$COMPILED" \ + -it:"{http://www.jenitennison.com/xslt/xspec}main" \ + || die "Error running the test suite" + else + # for XQuery + xquery "${saxon_custom_options_array[@]}" \ + -o:"$RESULT" -q:"$COMPILED" \ + || die "Error running the test suite" + fi fi fi @@ -394,6 +486,11 @@ fi if [ -z "${COVERAGE_REPORTER_XSL}" ]; then COVERAGE_REPORTER_XSL="$XSPEC_HOME/src/reporter/coverage-report.xsl" fi +if test -n "$XSPEC_HTML_REPORT_THEME"; then + REPORT_THEME="$XSPEC_HTML_REPORT_THEME" +else + REPORT_THEME="default" +fi echo echo "Formatting Report..." @@ -401,6 +498,7 @@ xslt -o:"$HTML" \ -s:"$RESULT" \ -xsl:"${HTML_REPORTER_XSL}" \ inline-css=true \ + report-theme="$REPORT_THEME" \ || die "Error formatting the report" if test -n "$COVERAGE"; then echo @@ -410,6 +508,7 @@ if test -n "$COVERAGE"; then -s:"$COVERAGE_XML" \ -xsl:"${COVERAGE_REPORTER_XSL}" \ inline-css=true \ + report-theme="$REPORT_THEME" \ || die "Error formatting the coverage report" echo "Report available at $COVERAGE_HTML" #$OPEN "$COVERAGE_HTML" @@ -427,14 +526,14 @@ else fi ## -## cleanup +## error on test failure ##################################################### ## -if test -n "$SCHEMATRON"; then - rm -f "$SCH_PREPROCESSED_XSPEC" - rm -f "$TEST_DIR/$TARGET_FILE_NAME-var.txt" - rm -f "$TEST_DIR/$TARGET_FILE_NAME-step1.sch" - rm -f "$TEST_DIR/$TARGET_FILE_NAME-step2.sch" - rm -f "$SCH_PREPROCESSED_XSL" + +if [ -n "${ERROR_ON_TEST_FAILURE}" ]; then + xslt \ + -s:"${RESULT}" \ + -xsl:"${XSPEC_HOME}/src/cli/terminate-on-test-failure.xsl" 2> /dev/null \ + || die "Found a test failure" fi -echo "Done." \ No newline at end of file +echo "Done." diff --git a/htmlbook-xsl/xspec/chunk.xspec b/htmlbook-xsl/xspec/chunk.xspec index ce1a518a..303bcf34 100755 --- a/htmlbook-xsl/xspec/chunk.xspec +++ b/htmlbook-xsl/xspec/chunk.xspec @@ -1,1173 +1,1135 @@ - - - - - - - - - - - - - - - -acknowledgments:decimal -afterword:decimal -appendix:decimal -bibliography:decimal -chapter:decimal -colophon:decimal -conclusion:decimal -copyright-page:decimal -dedication:lower-roman -foreword:lower-roman -glossary:decimal -halftitlepage:lower-roman -index:decimal -introduction:decimal -preface:lower-roman -titlepage:lower-roman -toc:lower-roman - - - - - -
-

Here comes a cross-reference: see

-
-
- - - - - - - - -
- - - - - - - - - Chapter 1 - - - - - - -
-

Here comes a cross-reference: see PLACEHOLDER

-
-
- - - - - - - PLACEHOLDER - - - - - - - - - - - Chapter 1 - - -
- - - -
-

Here comes an XREF with an href pointing to another file:

-

Another XREF with an href pointing to another file: PLACEHOLDER

-

XREF pointing to a URL

-

Another XREF with an href pointing to another file: PLACEHOLDER

-
-
- - - - - - - Chapter 1 - - - - - - - - - Chapter 1 - - - - - - - - - - - - - - - PLACEHOLDER - -
- - - - - - -
-

Here comes a bogus cross-reference: see

-

Another bogus cross-referece: see

-

Third bogus cross-reference: see I do believe this is bogus

-

Fourth bogus cross-reference: See I do believe this is bogus

-
-
- - - - - ??? - - - - - - - ??? - - - - - - - ??? - - - - - - - ??? - - -
- - - - -
- DO NOT TOUCH ME - DO NOT TOUCH ME - - - - - - -
-
- - - - - DO NOT TOUCH ME - -
- - - - - DO NOT TOUCH ME - - - - - - - - - Chapter 1 - - - - - - - - - - - - - - - - ??? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
- - - - - ... - - - - - - - ... - - - - - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - -
- - - - - - -
-

Preface Title

-

Cool preface

-
-

Sect1 Title

-

Cool Sect1

-
-
-
-

Chapter Title

-

Cool chapter

-
- -
Cool figure
-
-

Now here are the XREFs:

-

XREF to preface:

-

XREF to chapter:

-

XREF to sect1:

-

XREF to figure (default pagenum-style):

-

XREF with custom pagenum-style:

-

"Stealth" XREF:

-
-
- - - - - ... - -
- - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - - - - - - - - - - ... - - - - - - - -
-

Hyperlink Spree!

-

O'Reilly Media

-

http://oreilly.com

-

oreilly.com

-

oreilly.com

-

some awesome location in the text

-

XREF masquerading as an external hyperlink (no proper data-type)

-

tools@oreilly.com

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O'Reilly Media (http://oreilly.com) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
{
-        "context_is_admin":  [["role:admin"]],
-        "admin_or_owner":  [["is_admin:True"], ["project_id:%(project_id)s"]], 1
-        ...
-      
-
- - - - - - - - - - - - - - - - -
- - - - - -
-

AWESOME CHAPTER

-

Check out this pic:

-
-
AWESOME PIC
- awesomeness -
-

And this one, too:

-
-
AWESOMENESS SQUARED
- awesomeness to the second power -
-

See for lots of awesomeness.

-

See for awesomeness.

-

See for yet more awesomeness

-
-
-

AWESOME SUBSECTION

-

I'm here only as an XREF referent.

-
- -
- - - - 1-2 -
- - - - Chapter 1, AWESOME CHAPTER - - - - - sect1 - - “AWESOME SUBSECTION” - - - - - - - - - - - - -
-

First chapter

-

Some text

-

XREF to second chapter is here: see

-

Now here's a sidebar:

- -

XREF to the sect1 in second chapter: see

-
-
-

Second chapter

-

Let's add a sect1

-
-

Subsection heading

-

Always soft-code your cross-references

-

Like this one to the sidebar in the previous chapter: see

-
-
- -
- - - - chapter -sidebar - - - - - - - - chapter -sidebar - - - - - - - - chapter -sidebar - - - - - - - - - - - - - - - - - - - -
- - - - - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
-

This is another chapter and another chunk

-
- - - - - - ... - - - - - - - ... - - - - - - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a bogus cross-reference: see

-

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

-
-
- - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-

Here comes a cross-reference (link): see

-

Here comes an XREF (link) with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

- -

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

- -

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

- -

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

- -

Here comes a cross-reference: see

-

Here comes an XREF with a text node: see PLACEHOLDER TEXT

-
-
- - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - -
- - - -
-

Here comes a bogus cross-reference: see

-

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

- -

Here comes a bogus cross-reference: see

-

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

-

Here comes a bogus cross-reference (random text): see

-

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

-
-
- - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - - - - - ... - - - -
- - -
+ + + + + + + + + + + + + + + + + + + + + +acknowledgments:decimal +afterword:decimal +appendix:decimal +bibliography:decimal +chapter:decimal +colophon:decimal +conclusion:decimal +copyright-page:decimal +dedication:lower-roman +foreword:lower-roman +glossary:decimal +halftitlepage:lower-roman +index:decimal +introduction:decimal +preface:lower-roman +titlepage:lower-roman +toc:lower-roman + + + + + +
+

Here comes a cross-reference: see

+
+
+ + + + + + + + +
+ + + + + + + + + Chapter 1 + + + + + + +
+

Here comes a cross-reference: see PLACEHOLDER

+
+
+ + + + + + + PLACEHOLDER + + + + + + + + + + + Chapter 1 + + +
+ + + +
+

Here comes an XREF with an href pointing to another file:

+

Another XREF with an href pointing to another file: PLACEHOLDER

+

XREF pointing to a URL

+

Another XREF with an href pointing to another file: PLACEHOLDER

+
+
+ + + + + + + Chapter 1 + + + + + + + + + Chapter 1 + + + + + + + + + + + + + + + PLACEHOLDER + +
+ + + + + + +
+

Here comes a bogus cross-reference: see

+

Another bogus cross-referece: see

+

Third bogus cross-reference: see I do believe this is bogus

+

Fourth bogus cross-reference: See I do believe this is bogus

+
+
+ + + + + ??? + + + + + + + ??? + + + + + + + ??? + + + + + + + ??? + + +
+ + + + +
+ DO NOT TOUCH ME + DO NOT TOUCH ME + + + + + + +
+
+ + + + + DO NOT TOUCH ME + +
+ + + + + DO NOT TOUCH ME + + + + + + + + + Chapter 1 + + + + + + + + + + + + + + + + ??? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+ + + + + ... + + + + + + + ... + + + + + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + +
+ + + + + + +
+

Preface Title

+

Cool preface

+
+

Sect1 Title

+

Cool Sect1

+
+
+
+

Chapter Title

+

Cool chapter

+
+ +
Cool figure
+
+

Now here are the XREFs:

+

XREF to preface:

+

XREF to chapter:

+

XREF to sect1:

+

XREF to figure (default pagenum-style):

+

XREF with custom pagenum-style:

+

"Stealth" XREF:

+
+
+ + + + + ... + +
+ + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + + + + + + + + + + ... + + + + + + + +
+

Hyperlink Spree!

+

O'Reilly Media

+

http://oreilly.com

+

oreilly.com

+

oreilly.com

+

some awesome location in the text

+

XREF masquerading as an external hyperlink (no proper data-type)

+

tools@oreilly.com

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + O'Reilly Media (http://oreilly.com) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
{
+        "context_is_admin":  [["role:admin"]],
+        "admin_or_owner":  [["is_admin:True"], ["project_id:%(project_id)s"]], 1
+        ...
+      
+
+ + + + + + + + + + + + + + + + +
+ + + + + +
+

AWESOME CHAPTER

+

Check out this pic:

+
+
AWESOME PIC
+ awesomeness +
+

And this one, too:

+
+
AWESOMENESS SQUARED
+ awesomeness to the second power +
+

See for lots of awesomeness.

+

See for awesomeness.

+

See for yet more awesomeness

+
+
+

AWESOME SUBSECTION

+

I'm here only as an XREF referent.

+
+ +
+ + + + 1-2 +
+ + + + Chapter 1, “AWESOME CHAPTER” + + + + + sect1 + + “AWESOME SUBSECTION” + + + + + + + Capítulo 1, AWESOME CHAPTER + + + + + + + + +
+

First chapter

+

Some text

+

XREF to second chapter is here: see

+

Now here's a sidebar:

+ +

XREF to the sect1 in second chapter: see

+
+
+

Second chapter

+

Let's add a sect1

+
+

Subsection heading

+

Always soft-code your cross-references

+

Like this one to the sidebar in the previous chapter: see

+
+
+ +
+ + + + chapter +sidebar + + + + + + + + chapter +sidebar + + + + + + + + chapter +sidebar + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+

This is another chapter and another chunk

+
+ + + + + + ... + + + + + + + ... + + + + + + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a bogus cross-reference: see

+

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+
+
+ + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+

Here comes a cross-reference (link): see

+

Here comes an XREF (link) with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+ +

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+ +

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+ +

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+ +

Here comes a cross-reference: see

+

Here comes an XREF with a text node: see PLACEHOLDER TEXT

+
+
+ + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + +
+ + + +
+

Here comes a bogus cross-reference: see

+

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+ +

Here comes a bogus cross-reference: see

+

Here comes a bogus cross-reference with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+

Here comes a bogus cross-reference (random text): see

+

Here comes a bogus cross-reference (random text) with a text node: see PLACEHOLDER TEXT

+
+
+ + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + +
+
diff --git a/htmlbook-xsl/xspec/common-label-ancestors.xspec b/htmlbook-xsl/xspec/common-label-ancestors.xspec new file mode 100644 index 00000000..38328f7c --- /dev/null +++ b/htmlbook-xsl/xspec/common-label-ancestors.xspec @@ -0,0 +1,70 @@ + + + + + + + + + + + +appendix:A +chapter:1 +part:I +sect1:a +sect2:none +sect3:none +sect4:none +sect5:none + + + + + + +
+

First Part

+
+
+

Second Part

+
+ +
+ II +
+ + + + + +
+

First Chapter

+
+ +
+ 1 +
+ + + + +
+

A Chapter

+
+

First Subsection

+
+
+
+ 1.a +
+ +
diff --git a/htmlbook-xsl/xspec/common.xspec b/htmlbook-xsl/xspec/common.xspec index 13578a9f..b41a01a2 100755 --- a/htmlbook-xsl/xspec/common.xspec +++ b/htmlbook-xsl/xspec/common.xspec @@ -1,1916 +1,1912 @@ - - - - - -appendix:A -chapter:1 -part:I -sect1:a -sect2:none -sect3:none -sect4:none -sect5:none - - - - - - - -
-

jQuery rocks!

-

Ignore the second heading!

-

I like all the dollar signs

-
-
- - jQuery rocks! -
- - - -
-

XPath is the bestest

-

Ignore the second heading!

-

I like all the forward slashes (solidi)

-
-
- XPath is the bestest -
- - - -
-
-

Get this heading!

-

Ignore the second headling!

-
-

This is some boilerplate text

-
-
- Get this heading! -
- - - - - - -
-

First one!

-

Yup!

-
-
-

Second one!

-

Yeah!

-
-
-

Appendix, yo!

-

You betcha!

-
- -
- - 2 -
- - - - -
-

Prefaces!

-
-

First one!

-

Yup!

-
-
-
-

Chapters!

-
-

Love this sample markup!

-

Oh yeah!

-
-
-
-

Appendixes

-
-

Why plural? There's only one here!

-

D'oh!

-
-
- -
- - III -
- - - -
-

Lots of sect1s in this one

-
-

First subheading

-

Un!

-
-
-

Second subheading

-

Deux!

-
-
-

Third subheading

-

Trois!

-
-
-
- - a -
- - - -
-

Lots of sect1s in this one

-
-

First subheading

-

Un!

-
-
-

Second subheading

-

Deux!

-
-

Sub-subheading

-

Woohoo!

-
-
-
-

Third subheading

-

Trois!

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

First set o chapters!

-
-

First one!

-

Yup!

-
-
-

Second one!

-

Oh yeah!

-
-
-
-

Second set o chapters

-
-

Third one!

-

Hooray!

-
-
- -
- 3 -
- - - -
-

This is a chapter heading

-

Running out of amusing things to say

-
- -
A picture of the Tokyo skyline
-
- -
- -
A picture of the Paris skyline
-
-
-
- - - - - - 2 - - - - - - - 1-2 - -
- - - -
-

This is a preface heading

-

Some info about prereqs you need to appreciate this book

-
- -
A picture of a pencil
-
- -
- -
A picture of chalk
-
-
-
- - - - - - 2 - - - - - - - P-2 - -
- - - -
-

This is the Introduction heading

-

Introducing you to this book!

-
- -
A picture of a dachshund
-
- -
-

Section title

-
- -
A picture of a labrador
-
-
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

This is a Part heading

-

More text here

-
- -
A picture of the Barcelona skyline
-
- -
- -
A picture of the Quito skyline
-
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

Preface Heading

-

Here is a figure that precedes the part:

-
- -
A picture of the Oslo skyline
-
-
-
-

This is a Part heading

-

More text here

-
- -
A picture of the Barcelona skyline
-
- -
- -
A picture of the Quito skyline
-
-
-
- - - - - - 3 - - - - - - - I-2 - -
- - - - - - - -
-

This is a chapter

-

A paragraph for good measure!

- -
-
I am formal and have a caption.
-

$2 + 2 = 4$

-
-

A paragraph for good measure!

- -
-

$2 + 2 = 5$

-
-

A paragraph for good measure!

- -
-
-

$2 + 2 = 16$

-
-
-
- - - - - - 1 - - - - - - - - - - - - - - - - 2 - - - - - - - - 1-1 - - - - - - - - - - - - - - - - 1-2 - - -
- - - - -
-

This is a chapter

-

A paragraph for good measure!

- -
-
I am formal and have a caption.
-

$2 + 2 = 4$

-
-

A paragraph for good measure!

- -
-

$2 + 2 = 5$

-
-

A paragraph for good measure!

- -
-
-

$2 + 2 = 16$

-
-
-
- - - - - - 1 - - - - - - - - - - - - - - - - 2 - - - - - - - - P-1 - - - - - - - - - - - - - - - - P-2 - - -
- - - - - - -
-

This is a chapter

-

A paragraph for good measure!

- -
-
I am formal and have a caption.
-

$2 + 2 = 4$

-
-

A paragraph for good measure!

- -
-

$2 + 2 = 5$

-
-

A paragraph for good measure!

- -
-
-

$2 + 2 = 16$

-
-
-
- - - - - - 1 - - - - - - - - - - - - - - - - 2 - - - - - - - - A-1 - - - - - - - - - - - - - - - - A-2 - - -
-
- - - - -
-

This is a chapter heading

-

Running out of amusing things to say

- - - - - - - - - - - - -
Some programming languages
PythonJava
RubyPerl
- - - - - - - - - - - - - - - - - - - - - - -
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
-
-
- - - - - - 2 - - - - - - - 1-2 - -
- - - -
-

This is a preface heading

-

Running out of amusing things to say

- - - - - - - - - - - - -
Some dog breeds
PoodleGerman Shepherd
Bichon FriséBearded Collie
-
-

This section has another table

- - - - - - - - - - - - - - - - - - - - - - -
Our favorite vegetables
NameVegetable
Tomcarrot
Richardpotato
Harrycelery
-
-
-
- - - - - - 2 - - - - - - - P-2 - -
- - - -
-

This is an introduction heading

-

Running out of amusing things to say

- - - - - - - - - - - - -
Some more dog breeds
Golden RetrieverWeimaraner
Basset HoundScottish Terrier
- - - - - - - - - - - - - - - - - - - - - - -
Our favorite numbers
NameNumber
Tom18
Richard123456789
Harry0
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

This is a Part heading

-

More text here

- - - - - - - - - - - - -
Some programming languages
PythonJava
RubyPerl
- - - - - - - - - - - - - - - - - - - - - - -
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

Preface Heading

-

Here is a table that precedes the part:

- - - - - - - - - - - - -
Some beverages
teacoffee
lemonadebeer
-
-
-

This is a Part heading

-

More text here

- - - - - - - - - - - - -
Some programming languages
PythonJava
RubyPerl
- - - - - - - - - - - - - - - - - - - - - - -
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
-
-
- - - - - - 3 - - - - - - - I-2 - -
- - - -
-

This is a chapter heading

-

Running out of amusing things to say

-
-
My first code listing
-
puts "Hello World!"
-
-
-
My second code listing
-
10000.times { puts "Hello World" }
-
-
-
- - - - - - 2 - - - - - - - 1-2 - -
- - - -
-

This is a preface heading

-

Running out of amusing things to say

-
-
My third code listing
-
"abc".gsub("abc", "xyz")
-
-
-
My fourth code listing
-
this_variable_holds_the_number_2 = 2
-
-
-
- - - - - - 2 - - - - - - - P-2 - -
- - - -
-

This is an introduction heading

-

Running out of amusing things to say

-
-
My fifth code listing
-
<xsl:template match="h:h1">
-  <h2>Heading</h2>
-</xsl:template>
-
-
-

This example is in a sect1

-
-
My sixth code listing
-
h2 { color: green }
-
-
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

This is a Part heading

-

More text here

-
-
My first code listing
-
puts "Hello World!"
-
-
-
My second code listing
-
10000.times { puts "Hello World" }
-
-
-
- - - - - - 2 - - - - - - - I-2 - -
- - - -
-

Preface Heading

-

Here is an example that precedes the part:

-
-
Python listing
-
print "My first python listing"
-
-
-
-

This is a Part heading

-

More text here

-
-
My first code listing
-
puts "Hello World!"
-
-
-
My second code listing
-
10000.times { puts "Hello World" }
-
-
-
- - - - - - 3 - - - - - - - I-2 - -
- - - -
-

This is a chapter heading

-

Running out of amusing things to say

- - - - - - - - - - - - -
PythonJava
RubyPerl
- - - - - - - - - - -
-
pencil
paper
- - - - - - - - - - - - - - - - - - - - - - -
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
-
-
- - - - - - 1 - - - - - - - 1-1 - -
- - - - -
-

This is a chapter heading

-

Running out of amusing things to say

-
- - -
-
- -
- -
-
-
Image of the Ouagadougou skyline
- -
-
-
- - - - - - 1 - - - - - - - 1-1 - -
- - - -
-

Look! A Chapter!

-

Figure with a caption!

-
-
Image of Budapest skyline
- -
-

Figure with empty caption!

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

Look! A Chapter!

-

Table with a caption!

- - - - - - - - - - - - - - - - - - - - - - -
Recent US Presidents' pets
PresidentPet
Barack ObamaBo
George W. BushMiss Beazley
Bill ClintonSocks
-

Table with empty caption!

- - - - - - - - - - - - - - -
FoodCaloriesStats via Google
slice of pizza285
stalk of celery6
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Don't touch this heading!

-

I said, don't touch it!

-
-
- -

Don't touch this heading!

-
-
- - - - -
-

Touch this heading!

-

Add a label, pls

-
-
- -
- - - - -
-

Don't touch this heading!

-

I said, don't touch it!

-
-
- -

Don't touch this heading!

-
-
- - - - -
-
-

Touch this heading!

-

Add a label, pls

-
-
-
- -
- - - - - - - - - - - - - -
Do not touch this caption
Cell 1Cell 2
-
- - Do not touch this caption - -
- - - - - -
- - - - - - - - -
Touch this caption!
Cell 1Cell 2
-
-
- -
- - - - - -
-
Do not touch this caption
- -
-
- -
Do not touch this caption
-
-
- - - - - - -
-
Do not touch this caption
- -
-
- -
Do not touch this caption
-
-
- - - - - -
-
-
Touch this caption!
- -
-
-
- -
- - - - - - - - - -
- - - - - - -
- - - - - - - - - - -
-

First chapter

-

Some text

-

XREF to second chapter is here: see

-

Now here's a sidebar:

- -

XREF to the sect1 in second chapter: see

-

Same XREF as above, but with pagenumber suppressed: see

-

Same XREF as above, different xrefstyle formatting: see

-
-
-

Second chapter

-

Let's add a sect1

-
-

Subsection heading

-

Always soft-code your cross-references

-

Like this one to the sidebar in the previous chapter: see

-

This is an xref to a refentry: see

-

This is an xref to a refsect1: see

-

This is an xref to a refsect2: see

-
-
-

Output some text to stdout.

-
-
-
print "Hello World"
-
-
-
Refsect1 Title
-

More description would go here

-
-
Refsect2 Title
-

More description would go here

-
-
-
- -
-
- -
- - - - - - refentry - - - pagenum - - - - - - - - - - - - - refsect1 - - - pagenum - - - - - - - - - - - - - refsect2 - - - pagenum - - - - - - - - - - - - - - - chapter -sidebar - - - - pagenum - - - - - chapter -sidebar - - - - underline pagenum - - - - - chapter -sidebar - - - - - - - - - chapter -sect1 - - - - underline - - - - - - chapter -sidebar - - - - - - - - - chapter -sect1 - - - - - - - - - chapter -sidebar - - - - underline - - - - - chapter -sect1 - - - - underline - - - -
- - - - - - 1 - - - - - - - 1 - - - - - - - 1 - - - - - - - 0 - - - - - - - 1 - - - - - - - 1 - - - - - - - 1 - - - - - - - 0 - - - - - - - 0 - - - - - - - 0 - - - - - - - - - - - - - - - - - - -
FirstSecond
ThirdFourth
-
- - 2 -
- - - - - - - - - - - - - - - -
FirstSecond
ThirdFourth
-
- - 5 -
- - - - - - - - - - - - - - - - - - - - - - - -
FirstSecond
OneTwoThree
QuatreCinqSix
-
- 3 -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
FirstSecond
OneTwoThree
QuatreCinqSix
-
- 3 -
- - - - - - - - - - - - - - - - - - - - - - - - - -
FirstSecond
OneTwoThree
QuatreCinqSix
-
- 3 -
- - - - - - - - - - - - - - - - -
OneTwoThreeFour
QuatreCinqSixSept
-
- 4 -
- - - - - - - - - - - - - - - - - - - -
OneTwoThreeFour
QuatreCinqSixSept
-
- 4 -
- - - - - - - - - - - - - - - - - - - -
OneTwoThreeFour
QuatreCinqSixSept
-
- 4 -
- + + + + + + + + + + + + +appendix:A +chapter:1 +part:I +sect1:a +sect2:none +sect3:none +sect4:none +sect5:none + + + + + +
+

jQuery rocks!

+

Ignore the second heading!

+

I like all the dollar signs

+
+
+ + jQuery rocks! +
+ + + +
+

XPath is the bestest

+

Ignore the second heading!

+

I like all the forward slashes (solidi)

+
+
+ XPath is the bestest +
+ + + +
+
+

Get this heading!

+

Ignore the second headling!

+
+

This is some boilerplate text

+
+
+ Get this heading! +
+ + + + + + +
+

First one!

+

Yup!

+
+
+

Second one!

+

Yeah!

+
+
+

Appendix, yo!

+

You betcha!

+
+ +
+ + 2 +
+ + + + +
+

Prefaces!

+
+

First one!

+

Yup!

+
+
+
+

Chapters!

+
+

Love this sample markup!

+

Oh yeah!

+
+
+
+

Appendixes

+
+

Why plural? There's only one here!

+

D'oh!

+
+
+ +
+ + III +
+ + + +
+

Lots of sect1s in this one

+
+

First subheading

+

Un!

+
+
+

Second subheading

+

Deux!

+
+
+

Third subheading

+

Trois!

+
+
+
+ + a +
+ + + +
+

Lots of sect1s in this one

+
+

First subheading

+

Un!

+
+
+

Second subheading

+

Deux!

+
+

Sub-subheading

+

Woohoo!

+
+
+
+

Third subheading

+

Trois!

+
+
+
+ + +
+ + + + +
+

First set o chapters!

+
+

First one!

+

Yup!

+
+
+

Second one!

+

Oh yeah!

+
+
+
+

Second set o chapters

+
+

Third one!

+

Hooray!

+
+
+ +
+ 3 +
+ + + +
+

This is a chapter heading

+

Running out of amusing things to say

+
+ +
A picture of the Tokyo skyline
+
+ +
+ +
A picture of the Paris skyline
+
+
+
+ + + + + + 2 + + + + + + + 1-2 + +
+ + + +
+

This is a preface heading

+

Some info about prereqs you need to appreciate this book

+
+ +
A picture of a pencil
+
+ +
+ +
A picture of chalk
+
+
+
+ + + + + + 2 + + + + + + + P-2 + +
+ + + +
+

This is the Introduction heading

+

Introducing you to this book!

+
+ +
A picture of a dachshund
+
+ +
+

Section title

+
+ +
A picture of a labrador
+
+
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

This is a Part heading

+

More text here

+
+ +
A picture of the Barcelona skyline
+
+ +
+ +
A picture of the Quito skyline
+
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

Preface Heading

+

Here is a figure that precedes the part:

+
+ +
A picture of the Oslo skyline
+
+
+
+

This is a Part heading

+

More text here

+
+ +
A picture of the Barcelona skyline
+
+ +
+ +
A picture of the Quito skyline
+
+
+
+ + + + + + 3 + + + + + + + I-2 + +
+ + + + + + +
+

This is a chapter

+

A paragraph for good measure!

+ +
+
I am formal and have a caption.
+

$2 + 2 = 4$

+
+

A paragraph for good measure!

+ +
+

$2 + 2 = 5$

+
+

A paragraph for good measure!

+ +
+
+

$2 + 2 = 16$

+
+
+
+ + + + + + 1 + + + + + + + + + + + + + + + + 2 + + + + + + + + 1-1 + + + + + + + + + + + + + + + + 1-2 + + +
+ + + + +
+

This is a chapter

+

A paragraph for good measure!

+ +
+
I am formal and have a caption.
+

$2 + 2 = 4$

+
+

A paragraph for good measure!

+ +
+

$2 + 2 = 5$

+
+

A paragraph for good measure!

+ +
+
+

$2 + 2 = 16$

+
+
+
+ + + + + + 1 + + + + + + + + + + + + + + + + 2 + + + + + + + + P-1 + + + + + + + + + + + + + + + + P-2 + + +
+ + + + + + +
+

This is a chapter

+

A paragraph for good measure!

+ +
+
I am formal and have a caption.
+

$2 + 2 = 4$

+
+

A paragraph for good measure!

+ +
+

$2 + 2 = 5$

+
+

A paragraph for good measure!

+ +
+
+

$2 + 2 = 16$

+
+
+
+ + + + + + 1 + + + + + + + + + + + + + + + + 2 + + + + + + + + A-1 + + + + + + + + + + + + + + + + A-2 + + +
+ + + + +
+

This is a chapter heading

+

Running out of amusing things to say

+ + + + + + + + + + + + +
Some programming languages
PythonJava
RubyPerl
+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
+
+
+ + + + + + 2 + + + + + + + 1-2 + +
+ + + +
+

This is a preface heading

+

Running out of amusing things to say

+ + + + + + + + + + + + +
Some dog breeds
PoodleGerman Shepherd
Bichon FriséBearded Collie
+
+

This section has another table

+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite vegetables
NameVegetable
Tomcarrot
Richardpotato
Harrycelery
+
+
+
+ + + + + + 2 + + + + + + + P-2 + +
+ + + +
+

This is an introduction heading

+

Running out of amusing things to say

+ + + + + + + + + + + + +
Some more dog breeds
Golden RetrieverWeimaraner
Basset HoundScottish Terrier
+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite numbers
NameNumber
Tom18
Richard123456789
Harry0
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

This is a Part heading

+

More text here

+ + + + + + + + + + + + +
Some programming languages
PythonJava
RubyPerl
+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

Preface Heading

+

Here is a table that precedes the part:

+ + + + + + + + + + + + +
Some beverages
teacoffee
lemonadebeer
+
+
+

This is a Part heading

+

More text here

+ + + + + + + + + + + + +
Some programming languages
PythonJava
RubyPerl
+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
+
+
+ + + + + + 3 + + + + + + + I-2 + +
+ + + +
+

This is a chapter heading

+

Running out of amusing things to say

+
+
My first code listing
+
puts "Hello World!"
+
+
+
My second code listing
+
10000.times { puts "Hello World" }
+
+
+
+ + + + + + 2 + + + + + + + 1-2 + +
+ + + +
+

This is a preface heading

+

Running out of amusing things to say

+
+
My third code listing
+
"abc".gsub("abc", "xyz")
+
+
+
My fourth code listing
+
this_variable_holds_the_number_2 = 2
+
+
+
+ + + + + + 2 + + + + + + + P-2 + +
+ + + +
+

This is an introduction heading

+

Running out of amusing things to say

+
+
My fifth code listing
+
<xsl:template match="h:h1">
+  <h2>Heading</h2>
+</xsl:template>
+
+
+

This example is in a sect1

+
+
My sixth code listing
+
h2 { color: green }
+
+
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

This is a Part heading

+

More text here

+
+
My first code listing
+
puts "Hello World!"
+
+
+
My second code listing
+
10000.times { puts "Hello World" }
+
+
+
+ + + + + + 2 + + + + + + + I-2 + +
+ + + +
+

Preface Heading

+

Here is an example that precedes the part:

+
+
Python listing
+
print "My first python listing"
+
+
+
+

This is a Part heading

+

More text here

+
+
My first code listing
+
puts "Hello World!"
+
+
+
My second code listing
+
10000.times { puts "Hello World" }
+
+
+
+ + + + + + 3 + + + + + + + I-2 + +
+ + + +
+

This is a chapter heading

+

Running out of amusing things to say

+ + + + + + + + + + + + +
PythonJava
RubyPerl
+ + + + + + + + + + +
+
pencil
paper
+ + + + + + + + + + + + + + + + + + + + + + +
Our favorite colors
NameColor
Tomvermilion
Richardfuchsia
Harrycerulean
+
+
+ + + + + + 1 + + + + + + + 1-1 + +
+ + + + +
+

This is a chapter heading

+

Running out of amusing things to say

+
+ + +
+
+ +
+ +
+
+
Image of the Ouagadougou skyline
+ +
+
+
+ + + + + + 1 + + + + + + + 1-1 + +
+ + + +
+

Look! A Chapter!

+

Figure with a caption!

+
+
Image of Budapest skyline
+ +
+

Figure with empty caption!

+
+ +
+
+
+
+ + + + + + + + + + + + + +
+ + + +
+

Look! A Chapter!

+

Table with a caption!

+ + + + + + + + + + + + + + + + + + + + + + +
Recent US Presidents' pets
PresidentPet
Barack ObamaBo
George W. BushMiss Beazley
Bill ClintonSocks
+

Table with empty caption!

+ + + + + + + + + + + + + + +
FoodCaloriesStats via Google
slice of pizza285
stalk of celery6
+
+
+ + + + + + + + + + + + + +
+ + + + +
+

A Chapter

+
+
A Code Example
+
puts "Hello"
+
+
+
+ + 1-1 +
+ + + + +
+

A Chapter

+
+
A Code Example
+
puts "Hello"
+
+
+
+ 1 +
+ + + + +
+

Don't touch this heading!

+

I said, don't touch it!

+
+
+ +

Don't touch this heading!

+
+
+ + + + +
+

Touch this heading!

+

Add a label, pls

+
+
+ +
+ + + + +
+

Don't touch this heading!

+

I said, don't touch it!

+
+
+ +

Don't touch this heading!

+
+
+ + + + +
+
+

Touch this heading!

+

Add a label, pls

+
+
+
+ +
+ + + + + + + + + + + + + +
Do not touch this caption
Cell 1Cell 2
+
+ + Do not touch this caption + +
+ + + + + +
+ + + + + + + + +
Touch this caption!
Cell 1Cell 2
+
+
+ +
+ + + + + +
+
Do not touch this caption
+ +
+
+ +
Do not touch this caption
+
+
+ + + + + + +
+
Do not touch this caption
+ +
+
+ +
Do not touch this caption
+
+
+ + + + + +
+
+
Touch this caption!
+ +
+
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ + + + + + + + +
+

First chapter

+

Some text

+

XREF to second chapter is here: see

+

Now here's a sidebar:

+ +

XREF to the sect1 in second chapter: see

+

Same XREF as above, but with pagenumber suppressed: see

+

Same XREF as above, different xrefstyle formatting: see

+
+
+

Second chapter

+

Let's add a sect1

+
+

Subsection heading

+

Always soft-code your cross-references

+

Like this one to the sidebar in the previous chapter: see

+

This is an xref to a refentry: see

+

This is an xref to a refsect1: see

+

This is an xref to a refsect2: see

+
+
+

Output some text to stdout.

+
+
+
print "Hello World"
+
+
+
Refsect1 Title
+

More description would go here

+
+
Refsect2 Title
+

More description would go here

+
+
+
+ +
+
+ + + + + + + + refentry +
+ + pagenum + + + + + +
+ + + + + + + refsect1 +
+ + pagenum + + + + + +
+ + + + + + + refsect2 +
+ + pagenum + + + + + +
+ + + + + + + + + + chapter +sidebar + +
+ + pagenum + + + + + chapter +sidebar + +