2013-06-14 1 views
1

데이터를 데이터베이스에서 올바른 형식으로 내보낼 때. XSLT 스타일 시트에 넣으면 모든 것을 평평하게 놓습니다. 이 문제를 해결할 수있는 방법이 있습니까? 도와 줘서 고마워.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> 

답변

1

이 작업을 수행하는 간단한 방법 :

바꾸기 :

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

재치 시간

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

주의 마십시오

이 전혀 XSLT 질문이 아니다. HTML입니다. 관찰 된 브라우저 동작은 브라우저가 공백 문자 그룹을 단일 공백으로 나타내는 규칙 때문입니다.

+0

정말 고마워요. 감사합니다. – user2100632

+0

@ user2100632, 안녕하세요. –

0

테이블의 implementation_notes 내용을 행으로보고 싶습니다.

DB 출력을 재고하고 각 줄 주위에 xml 태그가 있어야한다고 생각합니다.
이것이 가능하지 않고 "end of line"으로 xslt 1.0으로 텍스트를 분할하려는 경우 재귀 적 템플릿 호출로 텍스트를 분할해야합니다.

또는 릴레이 테이블 행이 필요하지 않으면 콘텐츠 주위에 hmtl <pre>..</pre>을 넣으십시오.

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