在氧气中进行 DITA 到 PDF 的转换时,属性值需要以 pdf 形式出现
Attribute values needs to come in pdf while doing DITA to PDF conversion in oxygen
我的输入 xml 有很多元数据信息,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE topic
PUBLIC "com.rsicms.rsuite_te:doctypes:dita:topic" "topic.dtd">
<topic id="topic_1">
<title outputclass="title">LANDING GEARLANDING GEAR</title>
<titlealts>
<navtitle>FUNCTION, DATA FOR PLANS AND DESCRIPTION</navtitle>
</titlealts>
<prolog>
<metadata>
<data-about>
<data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
<data type="classification">01</data>
<data type="responsible.partner.company">F0302</data>
<data type="originator">F0302</data>
<data type="applicability">ALL</data>
<data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
<data type="quality.assurance">tabtop</data>
<data type="skill.level">sk01</data>
<data type="reason.for.update">First Release</data>
<data type="publication.code">UNKNOWN PUBLICATION</data>
</data-about>
<foreign outputclass="issuenum">001</foreign>
<unknown outputclass="date">2016-01-29</unknown>
</metadata>
</prolog>
<body>
<section>
<title>DESCRIPTION</title>
<p>The A380 is available with two types of turbofan engines, the
Rolls-Royce Trent 900 (variants A380-841, −842 and −843F) or the Engine
Alliance GP7000 (A380-861 and −863F). Noise reduction was an important
requirement in the A380 design, and particularly affects engine design.</p>
<p>Landing gears<ul>
<li>
<p>Nose Landing Gear</p>
</li>
<li>
<p>Wing Landing Gear (Bogie Type, 4 Wheels - 4 Braked)</p>
</li>
<li>
<p>Body Landing Gear (Bogie Type, 6 Wheels - 4 Braked)</p>
</li>
</ul>
</p>
</section>
<section>
<title>Wing Landing Gear</title>
<p>Each wing landing gear has a leg assembly and
a four-wheel bogie beam. The WLG leg includes a Bogie Trim Actuator
(BTA) and an oleo-pneumatic shock absorber.</p>
</section>
<section>
<title>Body Landing Gear</title>
<p>The two body landing gears have a six-wheel bogie
beam and a leg assembly that includes an oleo- pneumatic shock absorber.
A two-piece drag-stay assembly mechanically locks the leg in the extended
position.</p>
<fig>
<title>Landing gear</title>
<image align="center" href="../ICN-HSXWB-A-791111-H-F0302-00001-A-001-01.tif"/>
</fig>
</section>
</body>
</topic>
以上元信息以 pdf 格式出现,如下所示
我使用的 xslt 如下:
<xsl:template match="*[contains(@class,' topic/data ')]">
<fo:block xsl:use-attribute-sets="data">
<xsl:call-template name="commonattributes"/>
<xsl:for-each select="data-about/data">
<xsl:value-of select="@type"/>
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:text>: </xsl:text>
<fo:inline xsl:use-attribute-sets="data__label">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Data'"/>
</xsl:call-template>
<xsl:text></xsl:text>
</fo:inline>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
我希望 pdf 输出必须像元数据冒号的属性值一样,然后是信息,
data.module.code: HSXWB-A-79-11-11-00A01-000A-D
classification: 01
responsible.partner.company: F0302
.
.
.
就像我需要的那样。请帮助任何人。提前致谢
给定您的输入文件:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<title outputclass="title">LANDING GEARLANDING GEAR</title>
<titlealts>
<navtitle>FUNCTION, DATA FOR PLANS AND DESCRIPTION</navtitle>
</titlealts>
<prolog>
<metadata>
<data-about>
<data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
<data type="classification">01</data>
<data type="responsible.partner.company">F0302</data>
<data type="originator">F0302</data>
<data type="applicability">ALL</data>
<data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
<data type="quality.assurance">tabtop</data>
<data type="skill.level">sk01</data>
<data type="reason.for.update">First Release</data>
<data type="publication.code">UNKNOWN PUBLICATION</data>
</data-about>
<foreign outputclass="issuenum">001</foreign>
<unknown outputclass="date">2016-01-29</unknown>
</metadata>
</prolog>
</root>
(请注意,我添加了 root
元素。)
使用此 XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<xsl:template match="node()|@*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="metadata/*[position() > 1]">
<xsl:apply-templates/>
<fo:block>
<b>
<xsl:value-of select="concat(@outputclass, ':')"/>
</b>
<xsl:value-of select="concat(' ', current())"/>
</fo:block>
</xsl:template>
<xsl:template match="data-about/*">
<fo:block>
<b>
<xsl:value-of select="concat(@type, ':')"/>
</b>
<xsl:value-of select="concat(' ', current())"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
结果:
<fo:block><b>data.module.code:</b> HSXWB-A-79-11-11-00A01-000A-D</fo:block>
<fo:block><b>classification:</b> 01</fo:block>
<fo:block><b>responsible.partner.company:</b> F0302</fo:block>
<fo:block><b>originator:</b> F0302</fo:block>
<fo:block><b>applicability:</b> ALL</fo:block>
<fo:block><b>data.module.reference.code:</b> TRENTXWB-A-00-00-00-01A01-022A-D</fo:block>
<fo:block><b>quality.assurance:</b> tabtop</fo:block>
<fo:block><b>skill.level:</b> sk01</fo:block>
<fo:block><b>reason.for.update:</b> First Release</fo:block>
<fo:block><b>publication.code:</b> UNKNOWN PUBLICATION</fo:block>
<fo:block><b>issuenum:</b> 001</fo:block>
<fo:block><b>date:</b> 2016-01-29</fo:block>
希望这对您有所帮助!
编辑:编辑 XSLT 作为对 OP 评论的回答。
EDIT2:由于 OP 的评论再次更改了 XSLT。
我的输入 xml 有很多元数据信息,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE topic
PUBLIC "com.rsicms.rsuite_te:doctypes:dita:topic" "topic.dtd">
<topic id="topic_1">
<title outputclass="title">LANDING GEARLANDING GEAR</title>
<titlealts>
<navtitle>FUNCTION, DATA FOR PLANS AND DESCRIPTION</navtitle>
</titlealts>
<prolog>
<metadata>
<data-about>
<data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
<data type="classification">01</data>
<data type="responsible.partner.company">F0302</data>
<data type="originator">F0302</data>
<data type="applicability">ALL</data>
<data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
<data type="quality.assurance">tabtop</data>
<data type="skill.level">sk01</data>
<data type="reason.for.update">First Release</data>
<data type="publication.code">UNKNOWN PUBLICATION</data>
</data-about>
<foreign outputclass="issuenum">001</foreign>
<unknown outputclass="date">2016-01-29</unknown>
</metadata>
</prolog>
<body>
<section>
<title>DESCRIPTION</title>
<p>The A380 is available with two types of turbofan engines, the
Rolls-Royce Trent 900 (variants A380-841, −842 and −843F) or the Engine
Alliance GP7000 (A380-861 and −863F). Noise reduction was an important
requirement in the A380 design, and particularly affects engine design.</p>
<p>Landing gears<ul>
<li>
<p>Nose Landing Gear</p>
</li>
<li>
<p>Wing Landing Gear (Bogie Type, 4 Wheels - 4 Braked)</p>
</li>
<li>
<p>Body Landing Gear (Bogie Type, 6 Wheels - 4 Braked)</p>
</li>
</ul>
</p>
</section>
<section>
<title>Wing Landing Gear</title>
<p>Each wing landing gear has a leg assembly and
a four-wheel bogie beam. The WLG leg includes a Bogie Trim Actuator
(BTA) and an oleo-pneumatic shock absorber.</p>
</section>
<section>
<title>Body Landing Gear</title>
<p>The two body landing gears have a six-wheel bogie
beam and a leg assembly that includes an oleo- pneumatic shock absorber.
A two-piece drag-stay assembly mechanically locks the leg in the extended
position.</p>
<fig>
<title>Landing gear</title>
<image align="center" href="../ICN-HSXWB-A-791111-H-F0302-00001-A-001-01.tif"/>
</fig>
</section>
</body>
</topic>
以上元信息以 pdf 格式出现,如下所示
我使用的 xslt 如下:
<xsl:template match="*[contains(@class,' topic/data ')]">
<fo:block xsl:use-attribute-sets="data">
<xsl:call-template name="commonattributes"/>
<xsl:for-each select="data-about/data">
<xsl:value-of select="@type"/>
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:text>: </xsl:text>
<fo:inline xsl:use-attribute-sets="data__label">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Data'"/>
</xsl:call-template>
<xsl:text></xsl:text>
</fo:inline>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
我希望 pdf 输出必须像元数据冒号的属性值一样,然后是信息,
data.module.code: HSXWB-A-79-11-11-00A01-000A-D
classification: 01
responsible.partner.company: F0302
.
.
.
就像我需要的那样。请帮助任何人。提前致谢
给定您的输入文件:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<title outputclass="title">LANDING GEARLANDING GEAR</title>
<titlealts>
<navtitle>FUNCTION, DATA FOR PLANS AND DESCRIPTION</navtitle>
</titlealts>
<prolog>
<metadata>
<data-about>
<data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
<data type="classification">01</data>
<data type="responsible.partner.company">F0302</data>
<data type="originator">F0302</data>
<data type="applicability">ALL</data>
<data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
<data type="quality.assurance">tabtop</data>
<data type="skill.level">sk01</data>
<data type="reason.for.update">First Release</data>
<data type="publication.code">UNKNOWN PUBLICATION</data>
</data-about>
<foreign outputclass="issuenum">001</foreign>
<unknown outputclass="date">2016-01-29</unknown>
</metadata>
</prolog>
</root>
(请注意,我添加了 root
元素。)
使用此 XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<xsl:template match="node()|@*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="metadata/*[position() > 1]">
<xsl:apply-templates/>
<fo:block>
<b>
<xsl:value-of select="concat(@outputclass, ':')"/>
</b>
<xsl:value-of select="concat(' ', current())"/>
</fo:block>
</xsl:template>
<xsl:template match="data-about/*">
<fo:block>
<b>
<xsl:value-of select="concat(@type, ':')"/>
</b>
<xsl:value-of select="concat(' ', current())"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
结果:
<fo:block><b>data.module.code:</b> HSXWB-A-79-11-11-00A01-000A-D</fo:block>
<fo:block><b>classification:</b> 01</fo:block>
<fo:block><b>responsible.partner.company:</b> F0302</fo:block>
<fo:block><b>originator:</b> F0302</fo:block>
<fo:block><b>applicability:</b> ALL</fo:block>
<fo:block><b>data.module.reference.code:</b> TRENTXWB-A-00-00-00-01A01-022A-D</fo:block>
<fo:block><b>quality.assurance:</b> tabtop</fo:block>
<fo:block><b>skill.level:</b> sk01</fo:block>
<fo:block><b>reason.for.update:</b> First Release</fo:block>
<fo:block><b>publication.code:</b> UNKNOWN PUBLICATION</fo:block>
<fo:block><b>issuenum:</b> 001</fo:block>
<fo:block><b>date:</b> 2016-01-29</fo:block>
希望这对您有所帮助!
编辑:编辑 XSLT 作为对 OP 评论的回答。
EDIT2:由于 OP 的评论再次更改了 XSLT。