xsl 코드를 간단하게 할 방법?
글쓴이: 세벌 / 작성시간: 화, 2010/03/30 - 6:56오후
아래 코드를 보면 반복되는 부분 (예를 들어 font-family='hangang' font-size='10pt' text-align='right' 등등)이 많은 데 이걸 간단하게 할 방법 있을까요?
예를 들어 css 안 썼을 때 보다 css에 class 써서 코드를 간결하게 할 수 있는 것처럼...
<?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' 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' width='100%'> <fo:table-body> <xsl:for-each select='급여명세/급여'> <fo:table-row > <!-- --> <fo:table-cell number-rows-spanned='4' border-style='solid' width='.5cm'> <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-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>학비보조</fo:block> </fo:table-cell> <fo:table-cell number-rows-spanned='2' 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="format-number(봉급, '#,###,###.###')" /> </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="format-number(기말가계, '#,###,###.###')" /> </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="format-number(정근조정, '#,###,###.###')"/> </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-cell border-style='solid' number-rows-spanned='2' vertical-align='bottom' > <fo:block font-family='namsan' font-size='10pt' text-align='right' vertical-align='bottom'> <xsl:value-of select="format-number(급여총액, '#,###,###.###')"/> </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 number-rows-spanned='4' border-style='solid' width='0.5cm'> <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-cell border-style='solid'> <fo:block font-family='namsan' font-size='10pt'>본청구청</fo:block> </fo:table-cell> <fo:table-cell border-style='solid' number-rows-spanned='2'> <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-cell number-rows-spanned='2' border-style='solid'> <fo:block font-family='namsan' 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='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>
Forums:
예전에 한참 xml, xsl
예전에 한참 xml, xsl 섞어쓸 때 비슷한 문제를 jsp(servlet)을 써서 해결했던게 생각나네요.
서버사이드에서 동작하는 것이라면 jsp나 php등의 프로그램 가능한 놈을 xsl로 (url로) 걸면 좀 컴팩트하게 구성가능합니다.
서버사이드에서 동작하는 것이 아니라면, xsl:element를 활용하면 아마 될겁니다.
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
-----
오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂
fop를 써서 pdf
fop를 써서 pdf 만들려고 하는 거고요... 서버사이드는 아닙니다.
덕분에 아래와 같은 식으로 해결했습니다. 코드 길이는 생각보다 짧아지진 않았지만 유지하기는 편해졌네요. 예를 들어 금액 들어간 자리 폰트사이즈를 9에서 8로 바꿔 주셔요 이런 요청이 들어왔을 때 할 노가다 작업이 줄어들죠!
http://sebul.sarang.net/
세벌 https://sebuls.blogspot.kr/
css 쓸 수 있지
css 쓸 수 있지 않나요?
emerge money
http://wiki.kldp.org/wiki.php/GentooInstallSimple - 명령어도 몇 개 안돼요~
http://xenosi.de/
https://xenosi.de/
fop 실행시켜서 pdf
fop 실행시켜서 pdf 파일 뽑아내려고 하는 거라서... css 는 html 에만 적용되는 것으로 알고 있어서요... CSS 쓸 수 있다면 구체적인 방법도 알려주시면...
http://sebul.sarang.net/
세벌 https://sebuls.blogspot.kr/
댓글 달기