未知的 XSLT 解析错误

Unknown XSLT parse error

我创建了一个 XSL 转换,用于将 MS Word 文档 (OpenXML) 转换为 HTML。

如果我 link 转换到 XML 文件,转换工作正常:

<?xml-stylesheet type="text/xsl" href="word-transform.xsl"?>

然后在浏览器(如 FireFox)中打开 XML 文件。

但是如果我尝试用 node_xslt or an online transformer 之类的东西解析转换,我会收到 "unable to parse" 错误。

我的问题基本上是什么会在一种情况下导致解析错误,而在另一种情况下不会?

我在下面包含了 XSLT 和主要 XML 文件(一个 Word 文档实际上是几个 XML 文件),包括生成的 HTML(当我使用 FireFox)。

注意这些文件很大!所以我也对如何自己发现错误的猜测或建议感兴趣。

谢谢!

XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"
  xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:mv="urn:schemas-microsoft-com:mac:vml"
  xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
  xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
  xmlns:v="urn:schemas-microsoft-com:vml"
  xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"
  xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
  xmlns:w10="urn:schemas-microsoft-com:office:word"
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
  xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"
  xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
  xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk"
  xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
  xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
  xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
  xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
  xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
  mc:Ignorable="w14 wp14">
  <xsl:output method="html" indent="yes"/>

  <!-- Other files -->
  <xsl:variable name="wordDoc">document</xsl:variable>
  <xsl:variable name="relFilename" select="'document.xml.rels'" />

  <xsl:variable name="relLoc">
    <xsl:value-of select="$wordDoc" />
    <xsl:text>/word/_rels/</xsl:text>
    <xsl:value-of select="$relFilename" />
  </xsl:variable>

  <xsl:variable name="rels" select="document($relLoc)/rel:Relationships" />

  <!-- Paragraph level styles -->
  <xsl:variable name="title">Title</xsl:variable>
  <xsl:variable name="h1">Heading1</xsl:variable>
  <xsl:variable name="h2">Heading2</xsl:variable>
  <xsl:variable name="h3">Heading3</xsl:variable>
  <xsl:variable name="h4">Heading4</xsl:variable>
  <xsl:variable name="h5">Heading5</xsl:variable>
  <xsl:variable name="codePara">Codeparagraph</xsl:variable>
  <xsl:variable name="list">ListParagraph</xsl:variable>
  <xsl:variable name="noSpaceList">No-spacelist</xsl:variable>
  <xsl:variable name="captionStyle">Caption</xsl:variable>
  <xsl:variable name="noteStyle">Note</xsl:variable>
  <xsl:variable name="quotePara">Quote</xsl:variable>

  <!-- Class names -->
  <xsl:variable name="captionClass">caption</xsl:variable>
  <xsl:variable name="noteClass">well</xsl:variable>
  <xsl:variable name="highlightClass">highlight</xsl:variable>
  <xsl:variable name="noSpaceClass">no-space</xsl:variable>
  <xsl:variable name="imageClasses">image figure img-polaroid</xsl:variable>
  <xsl:variable name="prettyPrint">prettyprint</xsl:variable>

  <!-- Character level styles -->
  <xsl:variable name="link">Hyperlink</xsl:variable>
  <xsl:variable name="codeChar">Codecharacter</xsl:variable>

  <!-- ol and ul designations used by Word -->
  <xsl:variable name="ul">0</xsl:variable>
  <xsl:variable name="ol">1</xsl:variable>

  <!-- Image styles -->
  <xsl:variable name="figure">figure</xsl:variable>
  <xsl:variable name="window">window</xsl:variable>
  <xsl:variable name="image">image</xsl:variable>

  <!-- Used for creating human-readable formatting -->
  <xsl:variable name="br"><xsl:text>&#xA;</xsl:text></xsl:variable>
  <xsl:variable name="tab"><xsl:text>&#x9;</xsl:text></xsl:variable>

  <!-- Each block (paragraph, heading, etc.) is wrapped in w:p -->
  <xsl:template match="w:p">
    <!-- Determine the paragraph style -->
    <xsl:variable name="pStyle">
      <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
    </xsl:variable>

    <!-- Apply appropriate heading styles -->
    <xsl:choose>
      <xsl:when test="$pStyle = $title">
        <h1>
          <xsl:apply-templates />
        </h1>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $h1">
        <h1>
          <xsl:apply-templates />
        </h1>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $h2">
        <h2>
          <xsl:apply-templates />
        </h2>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $h3">
        <h3>
          <xsl:apply-templates />
        </h3>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $h4">
        <h4>
          <xsl:apply-templates />
        </h4>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $h5">
        <h5>
          <xsl:apply-templates />
        </h5>
        <xsl:value-of select="$br" />
      </xsl:when>
      <!-- Apply custom paragraph styles -->
      <!-- Code sample paragraph -->
      <xsl:when test="$pStyle = $codePara">
        <pre>
          <xsl:attribute name="class">
            <xsl:value-of select="$prettyPrint" />
          </xsl:attribute>
          <xsl:apply-templates /></pre>
        <xsl:value-of select="$br" />
      </xsl:when>
      <xsl:when test="$pStyle = $quotePara">
        <blockquote><xsl:apply-templates /></blockquote>
        <xsl:value-of select="$br" />
      </xsl:when>
      <!-- check if it's a list paragraph-->
      <xsl:when test="$pStyle = $list or $pStyle = $noSpaceList">
        <xsl:variable name="prevStyle">
          <xsl:for-each select="preceding::w:p">
            <xsl:if test="position() = last()">
              <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
            </xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <!-- if it's the first list paragraph -->
        <xsl:if test="$prevStyle != $list and $prevStyle != $noSpaceList">
          <ul>
            <!-- add $noSpaceList class if applicable -->
            <xsl:if test="$pStyle = $noSpaceList">
              <xsl:attribute name="class">
                <xsl:value-of select="$noSpaceClass" />
              </xsl:attribute>
            </xsl:if>
            <xsl:value-of select="$br" />
            <xsl:call-template name="add-list-element" />
          </ul>
          <xsl:value-of select="$br" />
        </xsl:if>
      </xsl:when>
      <!-- Apply paragraph formatting to the plain old paragraphs -->
      <xsl:otherwise >
        <p>
          <!-- Add paragraph level classes -->
          <xsl:choose>
            <!-- Add $captionClass if it's a caption -->
            <xsl:when test="$pStyle = $captionStyle">
              <xsl:attribute name="class">
                <xsl:value-of select="$captionClass" />
              </xsl:attribute>
            </xsl:when>
            <xsl:when test="$pStyle = $noteStyle">
              <xsl:attribute name="class">
                <xsl:value-of select="$noteClass" />
              </xsl:attribute>
            </xsl:when>
          </xsl:choose>
          <!-- Apply the applicable templates -->
          <xsl:value-of select="$br" />
          <xsl:apply-templates />
          <xsl:value-of select="$br" />
        </p>
        <xsl:value-of select="$br" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- add li elements if the paragraph is a list -->
  <xsl:template name="add-list-element">
    <!-- store the paragraph's style -->
    <xsl:variable name="pStyle">
        <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
    </xsl:variable>
    <!-- If it's a list... -->
    <xsl:if test="$pStyle = $list or $pStyle = $noSpaceList">
      <xsl:value-of select="$tab" />
      <li><xsl:apply-templates /></li>
      <xsl:value-of select="$br" />
      <!-- recursively add li elements to the following list paragraphs -->
      <xsl:for-each select="following::w:p">
        <xsl:if test="position() = 1">
          <xsl:call-template name="add-list-element" />
        </xsl:if>
      </xsl:for-each>
    </xsl:if>
  </xsl:template>

  <!-- Add image -->
  <xsl:template match="a:blip">
    <!-- get the ID value -->
    <xsl:variable name="imageId">
      <xsl:value-of select="@r:embed" />
    </xsl:variable>
    <!-- Return the image with that ID -->
    <xsl:variable name="imageSRC">
      <xsl:value-of select="$rels/rel:Relationship[@Id=$imageId]/@Target" />
    </xsl:variable>
    <!-- Create the image tag -->
    <img>
      <xsl:attribute name="src">
        <xsl:value-of select="$wordDoc"/>
        <xsl:text>/word/</xsl:text>
        <xsl:value-of select="$imageSRC" />
      </xsl:attribute>
      <xsl:attribute name="class">
        <xsl:value-of select="$imageClasses" />
      </xsl:attribute>
      <xsl:attribute name="title">
        <xsl:text></xsl:text>
      </xsl:attribute>
      <xsl:attribute name="alt">
        <xsl:text></xsl:text>
      </xsl:attribute>
    </img>
  </xsl:template>

  <!-- Add hyperlinks -->
  <xsl:template match="w:hyperlink">
    <!-- For the actual href, look in document.xml.rels -->
    <xsl:variable name="linkId">
      <xsl:value-of select="@r:id" />
    </xsl:variable>

    <xsl:variable name="anchor">
      <xsl:if test="@w:anchor">
        <xsl:text>#</xsl:text>
        <xsl:value-of select="@w:anchor" />
      </xsl:if>
    </xsl:variable>

    <xsl:variable name="href">
      <xsl:value-of select="$rels/rel:Relationship[@Id=$linkId]/@Target" />
      <xsl:value-of select="$anchor" />
    </xsl:variable>

    <a>
      <xsl:attribute name="href">
        <xsl:value-of select="$href" />
      </xsl:attribute>
      <!-- add 'type="anchor"' to anchors—used for smooth scrolling -->
      <xsl:if test="substring($href,1,1) = '#'">
        <xsl:attribute name="type">
          <xsl:text>anchor</xsl:text>
        </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates select="w:r" />
    </a>
  </xsl:template>

  <xsl:template match="w:br">
    <br />
    <xsl:value-of select="$br" />
    <xsl:value-of select="$tab" />
  </xsl:template>
  <!-- output paragraph text; one paragraph (w:p) might contain multiple w:r tags -->
  <xsl:template match="w:r">
    <xsl:apply-templates select="w:br" />
    <xsl:choose>
      <!-- Styles (e.g., strong and em) are in w:rPr -->
      <xsl:when test="w:rPr">
        <!-- w:rPr contains multiple styles, and each style handles applying templates to the next one, so we here we apply templates only to the first style -->
        <xsl:for-each select="child::w:rPr/*">
          <xsl:if test="position()=1">
            <xsl:apply-templates select="self::*" />
          </xsl:if>
        </xsl:for-each>
      </xsl:when>
      <!-- text that isn't styled doesn't have a w:rPr-->
      <xsl:when test="not(w:rPr)">
        <xsl:apply-templates select="w:t" />
      </xsl:when>
    </xsl:choose>

    <!-- images -->
    <xsl:if test="w:drawing">
      <xsl:apply-templates select="w:drawing" />
    </xsl:if>

  </xsl:template>

  <!-- inline styles (w:rPr) start -->
  <!-- style template: strong -->
  <xsl:template match="w:b">
    <strong>
      <xsl:call-template name="print-text" />
    </strong>
  </xsl:template>
  <!-- style template: Bold wtf -->
  <xsl:template match="w:bCs">
      <xsl:call-template name="print-text" />
  </xsl:template>

  <!-- style template: emphasis -->
  <xsl:template match="w:i">
    <em>
      <xsl:call-template name="print-text" />
    </em>
  </xsl:template>

  <!-- style template: emphasis wtf -->
  <xsl:template match="w:iCs">
    <xsl:call-template name="print-text" />
  </xsl:template>

  <!-- style template: highlight -->
  <xsl:template match="w:highlight">
    <span>
      <xsl:attribute name="class">
        <xsl:value-of select="$highlightClass" />
      </xsl:attribute>
      <xsl:call-template name="print-text" />
    </span>
  </xsl:template>

  <!-- inline code -->
  <xsl:template match="w:rStyle[@w:val=$codeChar]">
    <code>
      <xsl:call-template name="print-text" />
    </code>
  </xsl:template>

  <!-- link -->
  <xsl:template match="w:rStyle[@w:val=$link]">
    <xsl:call-template name="print-text" />
  </xsl:template>
  <!-- inline styles end -->
  <xsl:template name="print-text">
    <xsl:choose>
      <xsl:when test="following-sibling::w:*">
        <xsl:for-each select="following-sibling::w:*">
            <xsl:if test="position() = 1">
              <xsl:apply-templates select="self::*" />
            </xsl:if>
          </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="following::w:t">
          <xsl:if test="position() = 1">
            <xsl:apply-templates />
          </xsl:if>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- All text is wrapped in w:t, so this actually prints the text -->
  <xsl:template match="w:t">
    <xsl:value-of select="self::*" />
  </xsl:template>

</xsl:stylesheet>

XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="word-transform2.xsl"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">
  <w:body>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="Heading1" />
      </w:pPr>
      <w:r>
        <w:t>Here’s a sample doc!</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t xml:space="preserve">Founded in 1901 by Caleb </w:t>
      </w:r>
      <w:proofErr w:type="spellStart" />
      <w:r>
        <w:t>Deffell</w:t>
      </w:r>
      <w:proofErr w:type="spellEnd" />
      <w:r>
        <w:t xml:space="preserve">, </w:t>
      </w:r>
      <w:r w:rsidRPr="00831343">
        <w:rPr>
          <w:i />
        </w:rPr>
        <w:t>Deffell's Pants</w:t>
      </w:r>
      <w:r>
        <w:t xml:space="preserve"> has been the industry innovator in leg coverings for over 100 years. When your great-grandmother first dared to put on a pair of trousers, she turned to </w:t>
      </w:r>
      <w:proofErr w:type="spellStart" />
      <w:r>
        <w:t>Deffells</w:t>
      </w:r>
      <w:proofErr w:type="spellEnd" />
      <w:r>
        <w:t>. That sentiment is still a big pa</w:t>
      </w:r>
      <w:r>
        <w:t>rt of our design process today.</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="Quote" />
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">"Everyone wears pants. </w:t>
      </w:r>
      <w:proofErr w:type="gramStart" />
      <w:r>
        <w:t>Except those who don't.</w:t>
      </w:r>
      <w:proofErr w:type="gramEnd" />
      <w:r>
        <w:t xml:space="preserve"> That's why we make </w:t>
      </w:r>
      <w:proofErr w:type="spellStart" />
      <w:r>
        <w:t>jorts</w:t>
      </w:r>
      <w:proofErr w:type="spellEnd" />
      <w:r>
        <w:t xml:space="preserve">." —Caleb </w:t>
      </w:r>
      <w:proofErr w:type="spellStart" />
      <w:r>
        <w:t>Deffell</w:t>
      </w:r>
      <w:proofErr w:type="spellEnd" />
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t>With that sentiment in mind, I'm happy to announce the latest in</w:t>
      </w:r>
      <w:r>
        <w:t>novation in the Deffell's line:</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="Heading2" />
      </w:pPr>
      <w:r>
        <w:t>Design your own jeans</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t>Send us your measurements and pick the</w:t>
      </w:r>
      <w:r>
        <w:t>:</w:t>
      </w:r>
      <w:r>
        <w:t xml:space="preserve"> </w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Fabric</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Stitching</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Leather patch</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Buttons</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Rivets</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>Zippers</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="No-spacelist" />
      </w:pPr>
      <w:r>
        <w:t>And every aspect</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t xml:space="preserve">And we'll build a pair of </w:t>
      </w:r>
      <w:r>
        <w:t>jeans just the way you want it.</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:pPr>
        <w:pStyle w:val="Heading2" />
      </w:pPr>
      <w:r>
        <w:t>Hire a designer</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t xml:space="preserve">Or if you're not sure about all those options, tell us what you do in your jeans. Send us pictures of yourself skateboarding, running, breakdancing, </w:t>
      </w:r>
      <w:proofErr w:type="spellStart" />
      <w:r>
        <w:t>parkour-ing</w:t>
      </w:r>
      <w:proofErr w:type="spellEnd" />
      <w:r>
        <w:t>, walking your cat, o</w:t>
      </w:r>
      <w:r>
        <w:t>r whatever else you like to do.</w:t>
      </w:r>
    </w:p>
    <w:p w:rsidR="00831343" w:rsidRDefault="00831343" w:rsidP="00831343">
      <w:r>
        <w:t>Our top designers will analyze your life and build the jeans tha</w:t>
      </w:r>
      <w:r>
        <w:t>t will work just right for you.</w:t>
      </w:r>
      <w:bookmarkStart w:id="0" w:name="_GoBack" />
      <w:bookmarkEnd w:id="0" />
    </w:p>
    <w:p w:rsidR="003D4B67" w:rsidRDefault="00831343">
      <w:r>
        <w:t xml:space="preserve">So go on, </w:t>
      </w:r>
      <w:r>
        <w:t xml:space="preserve">order your custom jeans to </w:t>
      </w:r>
      <w:r w:rsidRPr="00831343">
        <w:rPr>
          <w:b />
        </w:rPr>
        <w:t>now</w:t>
      </w:r>
      <w:r>
        <w:t>!</w:t>
      </w:r>
    </w:p>
    <w:sectPr w:rsidR="003D4B67" w:rsidSect="00345542">
      <w:pgSz w:w="12240" w:h="15840" />
      <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0" />
      <w:cols w:space="720" />
      <w:docGrid w:linePitch="360" />
    </w:sectPr>
  </w:body>
</w:document>

HTML:

<h1>Here’s a sample doc!</h1>
<p>
Founded in 1901 by Caleb Deffell, <em>Deffell's Pants</em> has been the industry innovator in leg coverings for over 100 years. When your great-grandmother first dared to put on a pair of trousers, she turned to Deffells. That sentiment is still a big part of our design process today.
</p>
<blockquote>"Everyone wears pants. Except those who don't. That's why we make jorts." —Caleb Deffell</blockquote>
<p>
With that sentiment in mind, I'm happy to announce the latest innovation in the Deffell's line:
</p>
<h2>Design your own jeans</h2>
<p>
Send us your measurements and pick the: 
</p>
<ul class="no-space">
  <li>Fabric</li>
  <li>Stitching</li>
  <li>Leather patch</li>
  <li>Buttons</li>
  <li>Rivets</li>
  <li>Zippers</li>
  <li>And every aspect</li>
</ul>
<p>
And we'll build a pair of jeans just the way you want it.
</p>
<h2>Hire a designer</h2>
<p>
Or if you're not sure about all those options, tell us what you do in your jeans. Send us pictures of yourself skateboarding, running, breakdancing, parkour-ing, walking your cat, or whatever else you like to do.
</p>
<p>
Our top designers will analyze your life and build the jeans that will work just right for you.
</p>
<p>
So go on, order your custom jeans to <strong>now</strong>!
</p>

My question is basically what would cause a parse error in one situation but not in the other?

恕我直言,您的 XSLT 所需的外部文档的可用性位于第 37 行:

<xsl:variable name="rels" select="document($relLoc)/rel:Relationships" />

使用 Saxon 进行的测试表明您的样式表存在更多问题,即:

  • xsl:template 中的匹配模式可能不包含对变量的引用

我想您尝试过的其他处理器在这方面的容忍度更高。