xml xsl fop pdf 변환...
xml 파일을 이용해 pdf 만들려고 합니다.
그래서...xml 만들고 xsl 만들고...
fop -xml a.xml -xsl ma.xsl -pdf -pdf test.pdf
했더니만 에러 메시지가...
.xml과 .xsl 파일을 가지고 .fo 파일을 자동으로 만드는 도구가 있는 건지,
.fo 파일을 별도로 또 만들어야 되는 건지...
헷갈리네요..
아래는 에러메시지...
2010. 2. 23 오후 3:29:20 org.apache.fop.cli.Main startFOP
심각: Exception
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "html") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:217)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "html") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1323)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
... 3 more
Caused by: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "html") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:262)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
at org.apache.xml.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:204)
at org.apache.xml.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:277)
at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAXHandler.java:348)
at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAXHandler.java:318)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1315)
... 12 more


xml에 xsl을 적용하면
xml에 xsl을 적용하면 fo가 나오고요.
fo 파일을 fop에 걸면 pdf 내지는 target format이 나왔던 것으로 기억합니다.
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
다시 보니 fop에서
다시 보니 fop에서 한번에 pdf로 변환을 시도한 것같군요.
xsl의 적용결과로 나온 xml이 fo 형식에 맞지 않다는 말인것같습니다.
ps. 예시의 -pdf -pdf는 오타겠죠?
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
xslfo 형식에 맞게
xslfo 형식에 맞게 xsl을 만들어야 됩니다.
예시.
a.xml
s.xsl
<?xml version="1.0" encoding="euc-kr"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'> <fo:layout-master-set> <fo:simple-page-master master-name='a4'> <fo:region-body margin-top='1.5cm' margin-left='1cm' margin-right='1cm' margin-bottom='1.5cm'/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference='a4'> <fo:flow flow-name='xsl-region-body'> <fo:block font-family="namsan" font-size='14pt' text-align='center' line-height='1cm'> 2010년 1월분 급여 명세서 </fo:block> <fo:table table-layout='fixed' border-style='solid' border-color='black' width='100%'> <fo:table-body> <fo:table-row > <xsl:for-each select="급여명세"> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' text-align='center'>부서</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang'><xsl:value-of select="부서"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' text-align='center'>직급호봉</fo:block> </fo:table-cell > <fo:table-cell border-style='solid'> <fo:block font-family='hangang'><xsl:value-of select="직급호봉"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' text-align='center'>성명</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' ><xsl:value-of select="성명"/></fo:block> </fo:table-cell> </xsl:for-each> </fo:table-row> </fo:table-body> </fo:table> <!-- 11 --> <fo:table table-layout='fixed' border-style='solid' border-color='black' width='100%'> <fo:table-body> <xsl:for-each select='급여명세/급여'> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>봉급</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>기말가계</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>정근조정</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>정근가산</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>관리모범</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>대우수당</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>가족육아</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>학비보조</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="봉급"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="기말가계"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="정근조정"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="정근가산"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="관리모범"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="대우수당"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="가족육아"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'> <!-- <xsl:value-of select="학비보조"/> --> </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>기술정보</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>의료업무</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>장려위험</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>특수함정</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>연구업무</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>동의회</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>청경수당</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'></fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="기술정보"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="의료업무"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="장려위험"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="특수함정"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="연구업무"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="동의회"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="청경수당"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'> <!-- <xsl:value-of select="학비보조"/> --> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> <xsl:for-each select='급여명세/공제'> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>소득세</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>주민세</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>건강보험</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>기여금</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>소급기여</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>합산반납</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>상조회비</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>본청구청</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="소득세"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="주민세"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="건강보험"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="기여금"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="소급기여"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="합산반납"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="상조회비"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="본청구청"/></fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>연금대부</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>저축기부</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>단체행정</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>압류예치</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>추징금</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>정산소득</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>정산주민</fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>정산농특</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row > <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="연금대부"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="저축기부"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="단체행정"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="압류예치"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="추징금"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="정산소득"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="정산주민"/></fo:block> </fo:table-cell> <fo:table-cell border-style='solid'> <fo:block font-family='hangang' font-size='10pt' text-align='right'><xsl:value-of select="정산농특"/></fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> </fo:table-body> </fo:table> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template > </xsl:stylesheet>이런 식으로 하고
이런 식으로...
제가 올렸던 글에 대한 답을 찾아서 늦게나마 답글 올립니다.
http://sebul.sarang.net/
세벌 https://sebuls.blogspot.kr/
댓글 달기