2017-04-24 11 views
0

Antenna Houseでnode-set()を使いたいので、ソートされたリストの先行兄弟にアクセスできます。 (私はこの例に従おうとしています:[using preceding-sibling with with xsl:sortAntenna Houseでノードセットを使用するXSLT

名前空間がnode-set()にアクセスすると宣言するための構文はわかりません。 AHはエラーを出さないが、node-set()への私の呼び出しは失敗する。私が試した:ここ

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" 
       xmlns:msxsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="msxsl" version="1.0"> 

はXMLです:

<illustratedPartsCatalog> 
     <figure id="fig1">...</figure> 
     <catalogSeqNumber assyCode="00" figureNumber="01" indenture="0" item="000" itemVariant="A" subSubSystemCode="0" subSystemCode="0" systemCode="00"> 
<itemSeqNumber itemSeqNumberValue="000"> 
<quantityPerNextHigherAssy>XX</quantityPerNextHigherAssy> 
<partRef manufacturerCodeValue="00000" partNumberValue="11111-111"> 
</partRef> 
<partSegment> 
<itemIdentData> 
<descrForPart>VALVE ASSEMBLY</descrForPart></itemIdentData> 
</partSegment><applicabilitySegment><usableOnCodeAssy>X</usableOnCodeAssy> 
</applicabilitySegment></itemSeqNumber></catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <figure id="fig2">...</figure> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
     <catalogSeqNumber>...</catalogSeqNumber> 
    </illustratedPartsCatalog> 

XSLT:

<xsl:variable name="sortedCSN"> 
      <xsl:for-each select="illustratedPartsCatalog/catalogSeqNumber"> 
       <xsl:sort select="concat(itemSeqNumber/partRef/@partNumberValue, @figureNumber,@item)"/> 
       <xsl:copy-of select="." /> 
      </xsl:for-each> 
    </xsl:variable> 

    <xsl:template name="SortParts2" > 
      <xsl:for-each select="msxsl:node-set($sortedCSN)/catalogSeqNumber"> 
       <xsl:sort select="concat(itemSeqNumber/partRef/@partNumberValue, @figureNumber,@item)"/> 
       <xsl:call-template name="catalogSeqNumber-NI"> 
        <xsl:with-param name="figNo" select="concat(@figureNumber,@figureNumberVariant)"/> 
        <xsl:with-param name="prfigNo" select="concat(preceding-sibling::catalogSeqNumber/@figureNumber,preceding-sibling::catalogSeqNumber/@figureNumberVariant)" /> 
       </xsl:call-template> 
      </xsl:for-each> 
     </xsl:template> 

    <xsl:template name="catalogSeqNumber-NI"> 
     <xsl:param name="figNo"/> 
     <xsl:param name="prfigNo" />   
      <fo:table-row keep-together.within-page="always" wrap-option="wrap"> 
       <fo:table-cell xsl:use-attribute-sets="table.cell.padding" text-transform="uppercase" wrap-option="wrap"> 
        <fo:block wrap-option="wrap"> 
         <xsl:value-of select=" ./itemSeqNumber/partRef/@partNumberValue"/> 
        </fo:block> 
       </fo:table-cell> 
       <fo:table-cell xsl:use-attribute-sets="table.cell.padding" text-align="start"> 
        <xsl:choose> 
         <xsl:when test="$figNo"> 
          <fo:block> 
           <xsl:text> </xsl:text><xsl:value-of select="$figNo"/><xsl:text> </xsl:text> <xsl:value-of select="$prfigNo"/> 
          </fo:block> 
         </xsl:when> 
         <xsl:otherwise> 
           <fo:block /> 
         </xsl:otherwise> 
        </xsl:choose> 
       </fo:table-cell> 

       <fo:table-cell xsl:use-attribute-sets="table.cell.padding" text-align="start"> 
        <fo:block> 
         <xsl:if test="./itemSeqNumber/partLocationSegment/notIllustrated"> 
          <xsl:text>-</xsl:text> 
         </xsl:if> 

         <xsl:choose> 
          <xsl:when test="@item"> 
           <xsl:variable name="itemNo"> 
            <xsl:call-template name="suppressZero" > 
             <xsl:with-param name="pText" select="@item"/> 
            </xsl:call-template> 
           </xsl:variable> 
           <xsl:text>&#160;</xsl:text> 
           <xsl:value-of select="concat($itemNo,@itemVariant)"/> 
          </xsl:when> 
          <xsl:otherwise /> 
         </xsl:choose> 
        </fo:block> 
       </fo:table-cell> 

       <fo:table-cell xsl:use-attribute-sets="table.cell.padding"> 
        <fo:block> 
         <xsl:value-of select="./itemSeqNumber/quantityPerNextHigherAssy"/> 
        </fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
     </xsl:template> 
+0

XSLT全体を単一のスタイルシートとして表示できますか?どんなプロセッサーで変換を実行しますか?(デフォルトのJava/Xalan、Saxon、.NET)と正確なエラーメッセージは何ですか? –

+0

'axf:node-set()'関数はありません。 'axf:node-set()'を使用しようとすると、関数が存在しないことを示すエラーメッセージが表示されることが予想されます。 –

+0

テキストのエラーは、テンプレートの外にあった迷子のテキスト文字が原因です。私はEditPad ProとAntenna House 6.2を使用しています。 – Caroline

答えて

1

私は、Windows上のアンテナハウスのデフォルトはと試みてMSXMLを使用することだと思いますnode-set拡張機能を使用する限り、xmlns:msxsl="urn:schemas-microsoft-com:xslt"は問題ありません。

は、私はあなたが単に見ることなく、これらすべてのxsl:sort試みを判断することはできません、あなたは限り、あなたがそれを示してきたように(示されている入力して意味をなすために

<xsl:variable name="sortedCSN"> 
      <xsl:for-each select="illustratedPartsCatalog/catalogSeqNumber"> 
       <xsl:sort select="concat(itemSeqNumber/partRef/@partNumberValue, @figureNumber,@item)"/> 
       <xsl:copy-of select="." /> 
      </xsl:for-each> 
    </xsl:variable> 

<xsl:template name="SortParts2" > 
     <xsl:for-each select="msxsl:node-set($sortedCSN)/catalogSeqNumber"> 
      <xsl:sort select="concat(itemSeqNumber/partRef/@partNumberValue, @figureNumber,@item)"/> 
      <xsl:call-template name="catalogSeqNumber-NI"> 
       <xsl:with-param name="figNo" select="concat(@figureNumber,@figureNumberVariant)"/> 
       <xsl:with-param name="prfigNo" select="concat(preceding-sibling::catalogSeqNumber/@figureNumber,preceding-sibling::catalogSeqNumber/@figureNumberVariant)" /> 
      </xsl:call-template> 
     </xsl:for-each> 
    </xsl:template> 

にXSLTを変更する必要があると思いますソートされるデータ)。

一方、スタイルシートが正しいXSLTまたはXMLでないというエラーが表示された場合は、最小限の完全なスタイルシートを表示して問題を再現することをお勧めします。

+0

ありがとうございます、私はあなたの提案を試み、SortParts2はまだ失敗しています。コンテキストノードIllustratedPartsCatalogからSortParts2が呼び出されている場合は、それが役に立ちます。 – Caroline

関連する問題