xsl-list
[Top] [All Lists]

Re: [xsl] Unrequested stdout output

2016-12-21 08:38:55
Hi Mark,

you can either declare the principal output as text:
<xsl:output method="text"/>

Or you can divert standard output into //./NUL at batch file level by appending
> //./NUL
to your java command line.

Gerrit

On 21.12.2016 15:14, Mark Wilson mark(_at_)knihtisk(_dot_)org wrote:
I build one of my websites (www.cpslib.org) using a Windows batch file
that has 45 distinct steps (I have never learned XProc and am 77 years
old so maybe never will). Even though I am using <xsl:result-document>
in the style sheet, the characters
    <?xml version="1.0" encoding="UTF-8"?>
 appear at stdout.  The document itself is written to file as specified
in result-document.

I have greatly simplified the batch file, XML document, and the
stylesheet, but the stdout output still appears when I run the batch
file. I have several other stylesheets in the batch file that use
result-document. Some exhibit this behavior, some do not.

I am unsure if this is an artifact of Saxon 97, the batch file process
,or my code.  Any help?
Mark

Batch file:
set SAXON_HOME=C:\saxon97
set SAXON_JAR=%SAXON_HOME%\saxon9he.jar
java -jar c:\saxon97\saxon9he.jar   work\text.xml xslt\071a-get-words.xsl

XML document (text.xml)
<?xml version="1.0" encoding="UTF-8"?>
<List>
   <Set lang="latin">
      <Text data="Lynx lynx" pofis-number="817" latin-original="Lynx lynx"
            text-location="coupon"
            domain="cr"
            year="2014"/>
   </Set>
</List>

XSLT stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema"; exclude-result-prefixes="xs"
version="2.0">

  <xsl:output indent="yes"/>

  <xsl:template match="List">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="Set">
    <xsl:if test="@lang eq 'latin'">
      <xsl:result-document href="work/latin-words.xml">
        <List>
          <xsl:apply-templates/>
        </List>
      </xsl:result-document>
    </xsl:if>

  </xsl:template>

  <xsl:template match="Text">
    <xsl:variable name="data" select="@data"/>
    <xsl:variable name="eng" select="@eng-original"/>
    <xsl:variable name="czech" select="@czech-original"/>
    <xsl:variable name="latin" select="@latin-original"/>
    <!-- Is the text on the stamp or elsewhere? -->
    <xsl:variable name="type" select="if(@text-location) then
@text-location else 'stamp'"/>
    <xsl:variable name="domain" select="@domain"/>
    <xsl:variable name="year" select="@year"/>
    <xsl:variable name="pofis-prefix" select="@pofis-prefix"/>
    <xsl:variable name="pofis-number" select="@pofis-number"/>
    <xsl:variable name="pofis-suffix" select="@pofis-suffix"/>

    <!--walk over each distinct value setting that value as the current
node-->
    <xsl:choose>

      <!-- Latin word list  -->
      <xsl:when test="parent::Set/@lang eq 'latin'">
        <xsl:for-each
select="distinct-values(tokenize(lower-case(@data), '\s+'))">
          <xsl:variable name="initial-letter"
select="upper-case(substring(., 1, 1))"/>
          <xsl:variable name="sort-word"
            select="concat($initial-letter, substring(., 2,
string-length(.) -1))"/>
          <xsl:choose>
            <!-- Discard numbers -->
            <xsl:when test="number(substring-before(., '.'))"/>
            <xsl:otherwise>
              <Word word="{.}" sort-word="{$sort-word}" latin="{$latin}"
domain="{$domain}"
                year="{$year}" pofis-prefix="{$pofis-prefix}"
pofis-number="{$pofis-number}"
                pofis-suffix="{$pofis-suffix}" type="{$type}"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>