gpt4 book ai didi

css - 在所有内容之后打印静态内容

转载 作者:太空宇宙 更新时间:2023-11-04 16:07:40 24 4
gpt4 key购买 nike

我在运行时使用 XSL 生成 html。我的任务是在打印完所有数据后打印签名部分。我正在打印这样的数据:

客户1数据
客户2数据
客户3数据
客户4数据
客户5数据

客户 2 的签名

每个客户数据都有id、姓名、地址等,每个客户最多5个详细信息。在所有客户数据的末尾,我需要打印客户 2 的签名部分。现在客户数据运行到 3 页,所有者部分仅在第一页打印。但我需要 3 页末尾的客户 2。

查看示例 XML..

<t>
<customer/>
<customer/>
<customer/>
<customer/>
<customer/>
</t>


我需要这样的输出

  Customer 1 data

Customer 2 data

Customer 3 data

Customer 4 data

Customer 5 data

Customer 2' Signature.

最佳答案

这个转换:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/*">
<xsl:apply-templates/>

<xsl:apply-templates mode="sign" select=
"customer[@id=2]/SignatureSection"/>
</xsl:template>

<xsl:template match="customer">
Customer <xsl:value-of select="position()"/> data
</xsl:template>

<xsl:template match="SignatureSection"/>

</xsl:stylesheet>

应用于以下 XML 文档时(因为惰性 OP 提供的假 XML 没有用):

<t>
<customer id="1">
Some Customer1 Data

<SignatureSection id="1">
Signature of Customer1
</SignatureSection>
</customer>
<customer id="2">
Some Customer2 Data
<SignatureSection id="2">
Signature of Customer2
</SignatureSection>
</customer>
<customer id="3">
Some Customer3 Data
<SignatureSection id="3">
Signature of Customer1
</SignatureSection>
</customer>
<customer id="3">
Some Customer4 Data
<SignatureSection id="4">
Signature of Customer4
</SignatureSection>
</customer>
<customer id="5">
Some Customer5 Data
<SignatureSection id="5">
Signature of Customer5
</SignatureSection>
</customer>
</t>

产生我们猜测可能是想要的结果:

 Customer 1 data

Customer 2 data

Customer 3 data

Customer 4 data

Customer 5 data

Signature of Customer2

关于css - 在所有内容之后打印静态内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8845914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com