Xslt 是否可以使用org.dita4publishers.html2插件从dita文件的顶部元素捕获id并将其添加到toc.js中

Xslt 是否可以使用org.dita4publishers.html2插件从dita文件的顶部元素捕获id并将其添加到toc.js中,xslt,dita,dita-ot,Xslt,Dita,Dita Ot,要从dita文件中获取id并将其添加到toc.js的html2插件中,请执行以下操作: 我的输入dita文件 <?xml version="1.0" encoding="UTF-8"?> <task id="info"> <title class="- topic/title ">Info</title> <info class="- topic/itemgroup task/info "> <fig id="status-wf-

要从dita文件中获取id并将其添加到toc.js的html2插件中,请执行以下操作:

我的输入dita文件

<?xml version="1.0" encoding="UTF-8"?>
<task id="info">
<title class="- topic/title ">Info</title>
<info class="- topic/itemgroup task/info ">
<fig id="status-wf-xsd" class="- topic/fig ">
<title class="- topic/title ">Status</title>
<image placement="inline" class="- topic/image " href="ram/raju/alias/code1_Oct31.jpg"></image>
</fig>
</info>
<info class="- topic/itemgroup task/info ">
<fig id="status-wf-xsd" class="- topic/fig ">
<title class="- topic/title ">Gnerator</title>
<image placement="inline" class="- topic/image " href="ragava/raju/alias/code1_Oct32.jpg"></image>
</fig>
</info>
</task>
但是我需要使用org.dita4publishers.html2插件输出toc.js

// 
// Javascript generated by HTML2 Toolkit plugin
// 
var tree;

function treeInit() {
tree = new YAHOO.widget.TreeView("treeDiv1");
var root = tree.getRoot();


var objd96e9 = {
label: " Info",
href: "Chunk820878609.html#", 
target:"contentwin"
};
var d96e9 = new YAHOO.widget.TextNode(objd96e9, root, false);



tree.draw(); 
} 

YAHOO.util.Event.addListener(window, "load", treeInit); 
// 
// Javascript generated by HTML2 Toolkit plugin
// 
var tree;

function treeInit() {
tree = new YAHOO.widget.TreeView("treeDiv1");
var root = tree.getRoot();


var objd96e9 = {
label: " Info",
href: "Chunk820878609.html#info", 
target:"contentwin"
};
var d96e9 = new YAHOO.widget.TextNode(objd96e9, root, false);



tree.draw(); 
} 

YAHOO.util.Event.addListener(window, "load", treeInit);
如果你有什么建议,请让我看看

提前谢谢

<xsl:template match="*[df:isTopicRef(.)]" mode="generate-dynamic-toc">
<xsl:param name="tocDepth" as="xs:integer" tunnel="yes" select="0"/>
<xsl:param name="parentId" as="xs:string"  tunnel="yes"/>
<xsl:param name="rootMapDocUrl" as="xs:string" tunnel="yes"/>

<xsl:if test="$tocDepth le $maxTocDepthInt">
<xsl:variable name="navPointTitle">
<xsl:apply-templates select="." mode="nav-point-title"/>      
</xsl:variable>
<xsl:variable name="topic" select="df:resolveTopicRef(.)" as="element()*"/>
<xsl:choose>
<xsl:when test="not($topic)">
<xsl:message> + [WARNING] generate-dynamic-toc: Failed to resolve topic reference to href "<xsl:sequence select="string(@href)"/>"</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="targetUri" select="htmlutil:getTopicResultUrl($outdir, root($topic), $rootMapDocUrl)" as="xs:string"/>
<xsl:variable name="relativeUri" select="relpath:getRelativePath($outdir, $targetUri)" as="xs:string"/>
<xsl:variable name="enumeration" as="xs:string?">
<xsl:apply-templates select="." mode="enumeration"/>
</xsl:variable>
<xsl:variable name="self" select="generate-id(.)" as="xs:string"/>


<xsl:sequence select="concat('&#x0a;', 'var obj', $self, ' = {')"/>
<xsl:text>
label: "</xsl:text>
<xsl:sequence select="local:escapeStringforJavaScript(
if ($enumeration = '')
then normalize-space($navPointTitle)
else concat($enumeration, ' ', $navPointTitle)
)"/>
<xsl:text>",
href: "</xsl:text>
<xsl:sequence select="$relativeUri"/><xsl:text>#</xsl:text><xsl:value-of select="task/attribute::id"/>
<xsl:text>", 
target:"</xsl:text><xsl:value-of select="$contenttarget"/><xsl:text>"
};
</xsl:text>

<xsl:call-template name="makeJsTextNode">
<xsl:with-param name="linkObjId" select="$self"/>
<xsl:with-param name="parentId" select="$parentId" tunnel="yes"/>
</xsl:call-template>

<!-- Any subordinate topics in the currently-referenced topic are
reflected in the ToC before any subordinate topicrefs.
-->
<xsl:apply-templates mode="#current" 
select="$topic/*[df:class(., 'topic/topic')], *[df:class(., 'map/topicref')]">
<xsl:with-param name="tocDepth" as="xs:integer" tunnel="yes"
select="$tocDepth + 1"
/>
<xsl:with-param name="parentId" select="$self" as="xs:string" tunnel="yes"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>    
</xsl:if>    
</xsl:template>
// 
// Javascript generated by HTML2 Toolkit plugin
// 
var tree;

function treeInit() {
tree = new YAHOO.widget.TreeView("treeDiv1");
var root = tree.getRoot();


var objd96e9 = {
label: " Info",
href: "Chunk820878609.html#", 
target:"contentwin"
};
var d96e9 = new YAHOO.widget.TextNode(objd96e9, root, false);



tree.draw(); 
} 

YAHOO.util.Event.addListener(window, "load", treeInit); 
// 
// Javascript generated by HTML2 Toolkit plugin
// 
var tree;

function treeInit() {
tree = new YAHOO.widget.TreeView("treeDiv1");
var root = tree.getRoot();


var objd96e9 = {
label: " Info",
href: "Chunk820878609.html#info", 
target:"contentwin"
};
var d96e9 = new YAHOO.widget.TextNode(objd96e9, root, false);



tree.draw(); 
} 

YAHOO.util.Event.addListener(window, "load", treeInit);