2016-11-16 1 views
0

제 작품에서 작은 버그가 있습니다. 작은 텍스트 부분에 밑줄을 긋기 만하면됩니다. 하지만 태그를 추가하려고 할 때 오류가 발생합니다. 유효한 아이가 아니라는 오류 보고서를 전합니다.<fo : inline> 요소를 내 xsl에 추가 할 수 없습니다

Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See fo:flow, "Mademoiselle ADS S, 1, 10000 TRO...") 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2304) 
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682) 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336) 
    at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:393) 
    at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:247) 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336) 
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682) 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336) 
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682) 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336) 
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682) 
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336) 
    at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2202) 
    at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1276) 
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:673) 
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1192) 
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1170) 
    at com.albiran.ebiza.utilitaires.PDFGenerator.produceXMLData(PDFGenerator.java:117) 
    at com.satec.pdf.SAPDFGenerator.generatePDF(SAPDFGenerator.java:163) 
    at com.albiran.ebiza.envoi.AsyncAttachment.getPath(AsyncAttachment.java:41) 
    ... 3 more 

그리고 다음과 같이 XSL 파일은 다음과 같습니다 : 다음과 같이

오류는

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"> 
    <xsl:import href="SAPdfUtils.xsl" /> 
    <xsl:output method="xml" encoding="ISO-8859-1" /> 

    <xsl:template match="/"> 
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> 
      <!-- ******************************** Déclaration, des pages ************************** --> 
      <fo:layout-master-set> 
       <fo:simple-page-master master-name="mainpage" 
        page-width="21cm" page-height="29.7cm" margin-top="1cm" 
        margin-bottom="1cm" margin-left="1cm" margin-right="1cm"> 
        <fo:region-body region-name="xsl-region-body" 
         extent="0cm" margin-top="5cm" margin-bottom="2.5cm" margin-left="2cm" 
         margin-right="2cm" /> 
       </fo:simple-page-master> 
      </fo:layout-master-set> 

      <fo:page-sequence master-reference="mainpage" 
       font-family="Arial"> 

       <!-- ******************************** Body ************************** --> 
       <fo:flow flow-name="xsl-region-body" font-size="12pt" 
        font-family="Arial" text-align="justify"> 

        <!-- Page 1 --> 
        <xsl:call-template name="break" /> 
        <xsl:call-template name="page1" /> 
        <fo:block break-after="page" /> 

       </fo:flow> 
      </fo:page-sequence> 
     </fo:root> 
    </xsl:template> 

    <xsl:template name="page1"> 
     <fo:table table-layout="fixed"> 
      <fo:table-column column-width="60%" /> 
      <fo:table-column column-width="40%" /> 
      <fo:table-body> 
       <fo:table-row text-align="left" font-weight="bold"> 
        <xsl:call-template name="cellBreak" /> 
        <fo:table-cell> 
         <fo:block> 
          <xsl:value-of select="/document/contractor/nameLong" /> 
         </fo:block> 
         <xsl:call-template name="break" /> 
         <fo:block> 
          <xsl:value-of select="/document/contractor/road" /> 
         </fo:block> 
         <xsl:call-template name="break" /> 
         <fo:block> 
          <xsl:value-of select="/document/contractor/city" /> 
         </fo:block> 
        </fo:table-cell> 
       </fo:table-row> 
      </fo:table-body> 
     </fo:table> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 
     <fo:block text-align="right"> 
      Paris, le 
      <xsl:value-of select="/document/date" /> 
     </fo:block> 
     <xsl:call-template name="break" /> 

     <fo:block font-weight="bold"> 
      Votre référence client : N° 
      <xsl:value-of select="/document/contractor/id" /> 
     </fo:block> 
     <fo:block font-weight="bold"> 
      N° de contrat : 
      <xsl:value-of select="/document/policy/id" /> 
     </fo:block> 
     <fo:block font-weight="bold"> 
      Intitulé du produit : 
      <xsl:value-of select="/document/policy/productName" /> 
     </fo:block> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 


      <fo:inline text-decoration="underline"> 
      Objet : Remise en vigueur de votre contrat d’assurance. 
      </fo:inline> 

     <fo:block padding="-10px"> 
      <fo:leader leader-length="90%" leader-pattern="rule" 
       rule-style="solid" rule-thickness="0.1mm" color="black" /> 
     </fo:block> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 

     <fo:block> 
      <xsl:value-of select="/document/contractor/longTitle" /> 
      <xsl:text>,</xsl:text> 
     </fo:block> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 

     <fo:block> 
      Suite à votre règlement du 
      <xsl:value-of select="/document/dateOfThePayment" /> 
      de votre prime de 
      <xsl:value-of select="/document/unpaidAmount" /> 
      <xsl:call-template name="space" /> 
      <xsl:text>€</xsl:text> 
      <xsl:call-template name="space" /> 
      pour la période du 
      <xsl:value-of select="/document/startDate" /> 
      au 
      <xsl:value-of select="/document/endDate" /> 
      , nous vous confirmons la remise en vigueur votre contrat d’assurance en date d’effet du 
      <xsl:value-of select="/document/reinstatementDate" /> 
      . 
     </fo:block> 
     <xsl:call-template name="break" /> 

     <fo:block> 
      Nous restons à votre disposition. 
     </fo:block> 
     <xsl:call-template name="break" /> 




     <fo:block> 
      Nous vous prions de croire, 
      <xsl:value-of select="/document/contractor/longTitle" /> 
      <xsl:text>, en l'expression de nos sentiments dévoués.</xsl:text> 
     </fo:block> 
     <xsl:call-template name="break" /> 
     <xsl:call-template name="break" /> 

     <fo:table table-layout="fixed"> 
      <fo:table-column column-width="60%" /> 
      <fo:table-column column-width="40%" /> 
      <fo:table-body> 
       <fo:table-row> 
        <xsl:call-template name="cellBreak" /> 
        <fo:table-cell> 
         <fo:block> 
          Votre Conseiller SATEC 
         </fo:block> 
         <xsl:call-template name="break" /> 
         <fo:block> 
          Tél. : 
          <xsl:value-of select="/document/satecPhone" /> 
         </fo:block> 
        </fo:table-cell> 
       </fo:table-row> 
      </fo:table-body> 
     </fo:table> 
    </xsl:template> 

    <xsl:template name="cellBreak"> 
     <fo:table-cell> 
      <xsl:call-template name="break" /> 
     </fo:table-cell> 
    </xsl:template> 

    <xsl:template name="tableLineBreak"> 
     <fo:table-row> 
      <xsl:call-template name="cellBreak" /> 
     </fo:table-row> 
    </xsl:template> 

</xsl:stylesheet> 

정말 슬프게 XSL 파일과 많은 경험을 필요가 없습니다. 그리고 iv에는 사람들이이 문제를 가지고 있지만 다른 이유로 볼 수 있습니다.

미리 감사드립니다. 뭔가 간단하거나 사소한 것이 누락 된 경우 죄송합니다. 여기에서 문제가 될 수 있는지 확실하지 않습니다.

+0

나는 이미 fo : table 또는 fo : block이 fo : flow의 자식이 아니어야한다고 생각했을 것입니다. 나는 보통 fo : block-container/fo : block에있는 fo : flow 아래의 모든 것을 감싼다. 그러나 그것은 이전과 같이 보일 때까지 어떤 종류의 fiddeling일지도 모른다. –

+0

내가 잘못 읽은 것이 아니라면 XSL에 "break"라는 템플릿이 없지만 항상 호출합니다. –

+0

예 .... 문제를 발견했습니다. 밑줄을 긋고 싶은 텍스트 아래의 fo : block은 문제가되는 줄입니다. 바로 아래에 있었고 나는 장님이었다. 그러나 유용한 정보에 감사드립니다. 그건 너무 많은 도움이되었습니다. : D –

답변

1

귀하의 fo:inlinefo:block 또는 유사해야합니다.

fo:flow (https://www.w3.org/TR/xsl/#fo_flow)의 정의를 보면 해당 콘텐츠 모델이 (%block;)+임을 알 수 있습니다. 당신은 그것의 정의에 %block;에서 링크를 경우 블록 레벨 FOS는 것을 볼 수 있습니다 :

  • 블록
  • 블록 컨테이너
  • 테이블 및 캡션
  • 테이블
  • 목록 블록

또한 fo:float 또는 fo:flow의 자식으로 '중립 용기'중 하나를 사용할 수 있습니다.

이 중 단지 fo:block에만 fo:inline을 직접 포함 할 수 있습니다. 당신은 산소 XML 편집기를 사용하는 경우

, 당신은 당신의 FO 프로세서에 제출하기 전에 FO 파일을 검증하기 위해 focheck (https://github.com/AntennaHouse/focheck)를 사용할 수 있습니다.

+0

처음에는 에 넣었지만 그 블록은 밑줄이 그어지고 인라인도됩니다. 그리고 iv는 이유를 전혀 모른다. 그 전에 블록에는 밑줄을 긋기위한 속성이있었습니다. 그러나 라인은 페이지의 끝까지 갔다. 나는 밑줄 친 텍스트 만 있으면된다. 그래서 그것을 제거하고 그것을 fo : inline에 추가했습니다. –

+0

블록과 인라인에서 모든 속성을 제거하더라도. 블록에는 여전히 밑줄이 쳐져 있습니다 ...... –

관련 문제