英文:
Control ID generated by DITA_OT transform of imageMap to HTML
问题
我有一个包含imagemap
的DITA主题。
当发布到HTML(响应式Web帮助)时,会生成两个HTML组件,一个是img
,另一个是map
。这两者必须通过一个id
字段连接,而DITA_OT会每次都生成一个唯一的id
。
这会触发我们版本控制系统中不必要的更改。
是否有一种方式可以指定用于链接这两个HTML组件的ID值?
英文:
I have a DITA topic that includes an imagemap
.
When published to HTML (responsive webhelp) two HTML components are generated, an img
and a map
. These must be connected via an id
field, for which DITA_OT freshly generates a unique one each time.
This triggers unnecessary changes in our version control system.
Is there a way of specifying the ID value to be used to link the two HTML components?
答案1
得分: 1
以下是翻译好的部分:
唯一的ID是在XSLT样式表“DITA-OT/plugins/org.dita.html5/xsl/ut-d.xsl”中的模板中生成的:
<xsl:template match="*[contains(@class,' ut-d/imagemap ')]" name="topic.ut-d.imagemap">
使用generate-id()函数。根据我所知和我测试的结果,我假设如果处理的DITA内容保持完全相同,生成的ID不应该改变。您可以进行类似的测试吗?将相同的DITA地图发布到两个输出文件夹,然后检查这个生成的ID在两个文件夹中是否不同。
但您也可以尝试通过创建一个DITA OT插件来控制ID,该插件将覆盖整个xsl模板,让您控制ID的值。
英文:
The unique IDs are generated in the XSLT stylesheet "DITA-OT/plugins/org.dita.html5/xsl/ut-d.xsl" in the template:
<xsl:template match="*[contains(@class,' ut-d/imagemap ')]" name="topic.ut-d.imagemap">
using the generate-id() function. From what I know and what I tested I assume that if the processed DITA content remains exactly the same, the generated IDs should not change. Can you perform a similar test? Publish the same DITA Map twice to two output folders, then check if this generated ID is different in the two folders.
But you could also try to take control over the IDs by creating a DITA OT plugin which overrides this entire xsl template and lets you take control over the ID value.
答案2
得分: 1
交还由发布过程生成的可交付成果(PDF、EPUB、HTML+CSS+JS文件)不应保存在版本控制系统中,因为它们从不由最终用户手动编辑。
版本控制系统应保留输入文件(DITA XML、Markdown等),发布系统应使用SSH连接到HTTP服务器上的特定文件夹,并将最终的可交付成果(PDF、HTML等)上传到那里。
因为我们曾经为自己的网站执行此操作,将XML文件和HTML文件保留在同一个版本控制的项目中,最终变得臃肿而没有真正的好处。
英文:
Taking a step back, here's an alternative answer:
Deliverables produced by the publishing process (PDFs, EPUBs, HTML+CSS+JS files) should not be kept in a version control system as they are never manually edited by the end user.
The version control system should keep the input files (DITA XML, Markdown, etc) and the publishing system should use SSH to connect to a certain folder on the HTTP server and upload the final deliverables (PDF, HTML, etc) there.
Because we used to do this for our own web site, keep the XML files and the HTML files in the same version controlled project which ended up being bloated without any real benefit.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论