plist xsl html转换

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:output indent="yes"/>
<xsl:param name="newfilename"> filename </xsl:param>
<xsl:template match="plist">
<html>
<head>
<title>
<xsl:value-of select="$filename"/>
</title>
</head>
<body>
<xsl:apply-templates mode="root"/>
</body>
</html>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="dict" mode="root">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<xsl:apply-templates mode="dict"/>
</table>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="dict" mode="dict">
<td valign="middle" align="center">
<table border="1" cellspacing="0" cellpadding="2">
<xsl:apply-templates mode="dict"/>
</table>
</td>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="dict" mode="array">
<tr>
<td valign="middle" align="center">
<table border="1" cellspacing="0" cellpadding="2">
<xsl:apply-templates mode="dict"/>
</table>
</td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="key" mode="dict">
<xsl:text disable-output-escaping="yes"> <tr> </xsl:text>
<td valign="middle" align="center">
<h4>
<xsl:value-of select="."/>
</h4>
</td>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="key" mode="root">
<h2>
<center>
<xsl:value-of select="."/>
</center>
</h2>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="array" mode="root">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<xsl:apply-templates mode="array"/>
</table>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="array" mode="dict">
<td valign="middle" align="center">
<table border="1" cellspacing="0" cellpadding="2">
<xsl:apply-templates mode="array"/>
</table>
</td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="string" mode="dict">
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="string" mode="root">
<xsl:value-of select="."/>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="string" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="integer" mode="dict">
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="integer" mode="root">
<xsl:value-of select="."/>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="integer" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="real" mode="dict">
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="real" mode="root">
<xsl:value-of select="."/>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="real" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="data" mode="dict">
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="data" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="true" mode="dict">
<td valign="middle" align="center"> YES </td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<xsl:template match="true" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center"> YES </td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="true" mode="root"> YES </xsl:template>
<!-- -->
<!-- -->
<xsl:template match="false" mode="dict">
<td valign="middle" align="center"> NO </td>
<xsl:text disable-output-escaping="yes"> </tr> </xsl:text>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="false" mode="array">
<tr>
<td valign="middle" align="center">
<xsl:value-of select="position() div 2 - 1"/>
</td>
<td valign="middle" align="center"> NO </td>
</tr>
</xsl:template>
<!-- -->
<!-- -->
<xsl:template match="false" mode="root"> NO </xsl:template>
<!-- -->
<!-- -->
</xsl:stylesheet>

pdf

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:output indent="yes"/>
<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" page-width="210mm" page-height="297mm" margin-top="0.25in" margin-bottom="0.25in" margin-left="0.25in" margin-right="0.25in">
<fo:region-body margin-top="0.5in" margin-bottom="0.5in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4" initial-page-number="1">
<fo:static-content flow-name="xsl-region-after">
<fo:block>
<fo:leader leader-pattern="rule" leader-length="18cm"/>
</fo:block>
<fo:block>
p.
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="//plist"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="plist">
<xsl:apply-templates mode="root"/>
</xsl:template>
<xsl:template match="dict" mode="root">
<xsl:apply-templates mode="dict"/>
</xsl:template>
<xsl:template match="dict" mode="array">
<xsl:apply-templates mode="dict"/>
</xsl:template>
<xsl:template match="dict" mode="dict">
<xsl:apply-templates mode="dict"/>
</xsl:template>
<xsl:template match="key" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="12pt" font-family="serif" font-weight="bold" line-height="15pt" keep-with-next="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="array" mode="root">
<xsl:apply-templates mode="array"/>
</xsl:template>
<xsl:template match="array" mode="dict">
<xsl:apply-templates mode="array"/>
</xsl:template>
<xsl:template match="string" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="string" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="integer" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="integer" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="real" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="real" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="data" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="data" mode="root">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="data" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
<xsl:value-of select="."/>
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="true" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
YES
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="true" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
YES
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="false" mode="dict">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
NO
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
<xsl:template match="false" mode="array">
<xsl:text disable-output-escaping="yes">
<fo:block font-size="11pt" font-family="serif" font-weight="normal" line-height="13pt" keep-with-previous="always" text-indent="
</xsl:text>
<xsl:value-of select="2*count(ancestor::*)+10"/>
<xsl:text disable-output-escaping="yes"> mm"> </xsl:text>
<xsl:value-of select="position() div 2 - 1"/>
<xsl:text disable-output-escaping="yes"> : </xsl:text>
NO
<xsl:text disable-output-escaping="yes"> </fo:block> </xsl:text>
</xsl:template>
</xsl:stylesheet>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值