2010-08-04 4 views
1

XSLT에서 숫자 이외의 글 머리 스타일을 처리하려면 어떻게해야합니까? 테이블 (XAML flowdocument)을 그려서 행을 넣고 싶습니다. 계층 적 들여 쓰기 및 특수 마커 스타일. (XAML) FlowDocument에서는 사용하지 않습니다.xslt 목록 표식 스타일

1. Some text......................... 
    a. Some text..................... 
     [1]. Some text................ 
      a. Some text again........ 
       [1]. Som text again.... 

원본은 다음과 같습니다.

<Root> 
    ... 
    <Step> 
     <Text>First Level</Text> 
    </Step> 
    <Step> 
     <Text>First Level</Text> 
     <Step> 
      <Text>Second Level</Text> 
      <Step> 
       <Text>Third Level</Text> 
       <Step> 
        <Text>Fourth Level</Text> 
       </Step> 
      </Step> 
     </Step> 
    </Step> 
    ... 
</Root> 

답변

0

<xsl:number.../> 명령어를 살펴보십시오. 문자와 로마 숫자를 포함하는 다양한 스타일의 숫자 서식을 지정합니다. XSLT1과 XSLT2 모두에서 사용할 수 있습니다.

0

그냥 재미를 위해,이 스타일 시트 :

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:inc="include"> 
<xsl:output method="text"/> 
    <xsl:template match="text()"/> 
    <xsl:template match="Step"> 
     <xsl:variable name="level" select="count(ancestor::Step)"/> 
     <xsl:value-of select="substring('&#x9;&#x9;&#x9;&#x9;',1,$level)"/> 
     <xsl:number format="{concat(
          substring('[', 
             1, 
             $level and $level mod 2 = 0), 
          substring('1a', 
             $level mod 2 + 1, 
             1), 
          substring(']', 
             1, 
             $level and $level mod 2 = 0))}. "/> 
     <xsl:value-of select="concat(Text,'&#xA;')"/> 
     <xsl:apply-templates select="Step"/> 
    </xsl:template> 
</xsl:stylesheet> 

출력 :

1. First Level 
2. First Level 
    a. Second Level 
     [1]. Third Level 
      a. Fourth Level