1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | <xsl:template match="td"> <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt"> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@border='1' or ancestor::tr[@border='1'] or ancestor::thead[@border='1'] or ancestor::table[@border='1']"> <xsl:attribute name="border-style"> <xsl:text>solid</xsl:text> </xsl:attribute> <xsl:attribute name="border-color"> <xsl:text>black</xsl:text> </xsl:attribute> <xsl:attribute name="border-width"> <xsl:text>1pt</xsl:text> </xsl:attribute> </xsl:if> <xsl:variable name="align"> <xsl:choose> <xsl:when test="@align"> <xsl:choose> <xsl:when test="@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsltherwise> <xsl:text>start</xsl:text> </xsltherwise> </xsl:choose> </xsl:when> <xsl:when test="ancestor::tr[@align]"> <xsl:choose> <xsl:when test="ancestor::tr/@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::tr/@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="ancestor::tr/@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsltherwise> <xsl:text>start</xsl:text> </xsltherwise> </xsl:choose> </xsl:when> <xsl:when test="ancestor::thead"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::table[@align]"> <xsl:choose> <xsl:when test="ancestor::table/@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::table/@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="ancestor::table/@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsltherwise> <xsl:text>start</xsl:text> </xsltherwise> </xsl:choose> </xsl:when> <xsltherwise> <xsl:text>start</xsl:text> </xsltherwise> </xsl:choose> </xsl:variable> <fo:block text-align="{$align}"> <xsl:apply-templates select="*|text()"/> </fo:block> </fo:table-cell> </xsl:template> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |