2014-02-11 1 views
1

입력 한 XML에는 숫자, 이미지 및 여러 위치에있는 교차 연결 텍스트가 있습니다. 태그를 사용하여 교차 링크를 코딩하려고하면 캡션 텍스트에도 교차 링크가 수행됩니다. 그러나 캡션 텍스트를 제외한 모든 곳에서 크로스 링크를 코딩해야합니다.그림 캡션에 대한 링크를 피하십시오. How

<par class="para">In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `Figure 1.1`.</par> 

     <par class="figurecaption">Figure 1.1 The ITIL service lifecycle</par> 
     <par class="image">gr000001</par> 

내 XSLT 코드는

<p>In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `<a href="chapter1.html#Fig1">Figure 1.1</a>`.</p> 

    <p><a href="chapter1.html#Fig1">Figure 1.1</a> The ITIL service lifecycle</p> 
    <img src="gr000001"/> 

는하지만, 내가 필요는 결과를 생성

<xsl:template match="text()" exclude-result-prefixes="html"> 
<xsl:analyze-string select="." regex="(Chapter|Figure|Table|Appendix)\s(\d+|[A-Z])(\.)?(\d+)?|(www.[^ ]+)|(http://[^ ]+)|(Section|section)\s(\d)\.(\d+)(\.)?(\d+|\d)?(\.)?(\d)?" flags="x"> 
<xsl:matching-substring>   
<a><xsl:attribute name="href"> 

..... 간다

<p>In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `<a href="chapter1.html#Fig1">Figure 1.1</a>`.</p> 

<p>`Figure 1.1` The ITIL service lifecycle</p> 
     <img src="gr000001"/> 

아이디어가 있으십니까?

답변

1

는 당신이 요구하는 것을 완전히 잘 모르겠지만, 방법에 대한 :

<xsl:template match="text()[parent::par/@class='para']"> 

그런 식으로, @class='figurecaption' 캐릭터 라인 분석에서 제외됩니다 par 요소.

필요한 경우

, 당신은 다음 그림 캡션의 텍스트와 일치하는 두 번째 템플릿을 작성할 수 있습니다 따로 조작 :

<xsl:template match="text()[parent::par/@class='figurecaption']"> 
+0

내가 대학에서 주제를 가지고 시작 @All 만에 전망을 보면 그래서! 프로덕션 환경에서'XSLT '를 사용해 본 적이 있습니까? 감사합니다. – loveNoHate

+0

이것은 약간 논쟁 거리입니다.하지만 어쨌든 저는 쓰고 있습니다. 그렇습니다. XSLT 응답자 대부분은 XSLT를 사용하는 생산 시스템을 구축하거나 유지해 왔지만, 나는 그렇지 않습니다. –

+0

안녕하세요, 나는 그 질문이보기에 개인적으로 다소다는 가정을 기반으로했습니다! 우리는 작은 [chat] (http://chat.stackoverflow.com/rooms/47231/xslt)을 가질 수 있습니까? 감사 – loveNoHate

관련 문제