div 기반 XHTML 레이아웃을 XSLT 1.0을 사용하는 테이블 기반 레이아웃으로 변환해야합니다. 기본 변환의 경우 테이블 구조를 잘 생성하는 스타일 시트 (아래)가 있습니다.XSL : HTML 테이블 속성을 만들기 위해 DIV 클래스 속성 읽기
출력에 표 특정 속성을 추가하기 위해 입력 XHTML에서 여러 클래스 속성을 구문 분석하는 방법을 이해할 수 없습니다.
내 샘플 XHTML은 (클래스에서 복사해도 그래, 난, 새 테이블 속성 이러한 싶습니다) :
<div class="table align-center">
<div class="tr">
<div class="td"><p>Table Cell 1</p></div>
<div class="td"><p>Table Cell 2</p></div>
</div>
</div>
다음과 같이 테이블 구조 확인을 구축 기본 XSL은 다음과 같습니다
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="div[contains(@class, 'table')]">
<table>
<xsl:copy-of select="attribute::node()"/>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="div[contains(@class, 'tr')]">
<tr>
<xsl:copy-of select="attribute::node()"/>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="div[contains(@class, 'td')]">
<td>
<xsl:copy-of select="attribute::node()"/>
<xsl:apply-templates/>
</td>
</xsl:template>
이 스타일 시트는 생산 : 내가 생산은하고 싶은 무엇
<table class="table align-center">
<tr class="tr">
<td class="td"><p>Table Cell 1</p></td>
<td class="td"><p>Table Cell 2</p></td>
</tr>
</table>
e는 다음과 같습니다.
<table class="table align-center" align="center">
<tr class="tr">
<td class="td"><p>Table Cell 1</p></td>
<td class="td"><p>Table Cell 2</p></td>
</tr>
</table>
XSLT 1.0에서는이 작업을 수행 할 수 있습니까? 두 개 이상의 클래스를 추가하고 필요한 테이블 특성을 추가하기 위해 구문 분석을 수행 할 수있을 정도로 일반적인 솔루션을 원합니다.
감사합니다. 이 문서에 적용
클래스 속성 값은 토큰 화를 요구하므로 http://www.exslt.org/str/functions/tokenize/index.html을 사용할 수 있는지 궁금합니다. 어떤 XSLT 1.0 프로세서를 대상으로합니까? –
안녕 마틴. PHP에 내장 된 XSL 프로세스를 사용합니다. 나는 기능이 지원되지 않습니다 믿습니다. – Kevin