1

私のデータがデータベースから正しい形式でエクスポートされているとき。それを XSLT スタイル シートに入れると、すべてが一直線に並べられます。これを修正する方法はありますか?ご協力ありがとうございました。

スタイルシート

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:user-scripts" xmlns:aras="http://www.aras.com">
      <xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes" cdata-section-elements="script msxsl:script"></xsl:output>
      <xsl:template match="Item[@type='Order']">
        <html>
          <body>
    <!-- Implementation Notes -->
            <table class="row">
              <tr>
                <td class="section" width="100%">
                  <b>Implementation Notes</b>
                </td>
          </tr>
            <tr>
                <td class="fieldValue">
                  <xsl:value-of select="implementation_notes"></xsl:value-of>
                </td>
            </tr>
         </table>
            <table class="row" height="10">
              <tr>
                <td></td>
              </tr>
            </table>
       </body>
      </html>
     </xsl:template>
     </xsl:stylesheet>

データ

    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Body>
        <Result>
          <Item type="Order">
            <implementation_notes>New Order.
    1. Instructions A
    1.1 Instructions A.1
    2. Instructions B
    2.1 Instructions B.1
    3. Instructions C
    3.1 Instructions C.1
    </implementation_notes>
         </Item>
        </Result>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
4

2 に答える 2

1

これを行う簡単な方法

交換:

              <xsl:value-of select="implementation_notes"></xsl:value-of>

              <pre><xsl:value-of select="implementation_notes"/></pre>

注意してください:

これは XSLT に関する質問ではありません。それはHTMLのものです。観察されたブラウザーの動作は、ブラウザーが空白文字のグループを 1 つのスペースとして表すという規則によるものです。

于 2013-06-14T14:50:12.597 に答える
0

implementation_notes の内容をテーブルの行として保持したいようです。

DB 出力を再検討し、各行に xml タグを付ける必要があると思います。
これが不可能で、xslt 1.0 でテキストを「行末」で分割したい場合は、再帰的なテンプレート呼び出しでテキストを分割する必要があります。

または、中継テーブルの行が必要ない場合は、コンテンツを hmtl で囲み <pre>..</pre>ます。

 <pre>
    <xsl:value-of select="implementation_notes"/>
 </pre>
于 2013-06-14T14:55:40.760 に答える