如何在SDL Tridion中使用XSLT将站点地图XML文件转换为痕迹?

Cod*_*der 2 asp.net xslt tridion tridion-2011

我有一个站点地图的XML文件,这里是:

<?xml version="1.0" encoding="utf-8"?>
<siteMap>
  <siteMapNode url="/" title="Home" tcmId="tcm:142-2-4">
    <siteMapNode url="/controls" title="Controls" tcmId="tcm:142-1131-4" type="structure group" />
    <siteMapNode url="/css" title="CSS" tcmId="tcm:142-1134-4" type="structure group" />
    <siteMapNode url="/js" title="JS" tcmId="tcm:142-1133-4" type="structure group" />
    <siteMapNode url="/xslt" title="XSLT" tcmId="tcm:142-1132-4" type="structure group"   />
    <siteMapNode url="/mobile" title="Mobile" tcmId="tcm:142-1165-4" type="structure group" />
    <siteMapNode url="/mobilebiscuitml" title="Mobile BiscuitML" tcmId="tcm:142-1180-4" type="structure group" />
    <siteMapNode url="/system" title="system" tcmId="tcm:142-136-4" type="structure group">
    <siteMapNode url="/system/captcha" title="Captcha" tcmId="tcm:142-260-4" type="structure group" />
    <siteMapNode url="/system/communicator" title="Communicator" tcmId="tcm:142-201-4" type="structure group" />
    <siteMapNode url="/system/errorpages" title="Error Pages" tcmId="tcm:142-322-4" type="structure group" />
    <siteMapNode url="/system/includes" title="includes" tcmId="tcm:142-138-4" type="structure group" />
    <siteMapNode url="/system/masterpages" title="Master Pages" tcmId="tcm:142-139-4" type="structure group" />
    <siteMapNode url="/system/outboundemail" title="Outbound Email" tcmId="tcm:142-199-4" type="structure group" />
    <siteMapNode url="/system/SiteEdit" title="SiteEdit" tcmId="tcm:142-214-4" type="structure group" />
    <siteMapNode url="/system/ui_widgets" title="UI Widgets" tcmId="tcm:142-320-4" type="structure group" />
    <siteMapNode url="/system/webtemplates" title="Web Templates" tcmId="tcm:142-333-4" type="structure group" />
    <siteMapNode url="/system/xml" title="Xml" tcmId="tcm:142-141-4" type="structure group" />
  </siteMapNode>
  <siteMapNode url="/App_GlobalResources" title="Website Labels" tcmId="tcm:142-295-4" type="structure group" />
    <siteMapNode url="/Bpo.aspx" title=" BPO" tcmId="tcm:142-10830-64" type="page" />
    <siteMapNode url="/Careers.aspx" title=" Careers" tcmId="tcm:142-10692-64" type="page" />
    <siteMapNode url="/bpoHitech.aspx" title=" Hitech" tcmId="tcm:142-10710-64" type="page" />
    <siteMapNode url="/news.aspx" title=" News" tcmId="tcm:142-10868-64" type="page" />
    <siteMapNode url="/ISD.html" title="ISD" tcmId="tcm:142-11027-64" type="page" />
    <siteMapNode url="/Services.aspx" title="Services" tcmId="tcm:142-10681-64" type="page" />
    <siteMapNode url="/Knowledge.aspx" title="Knowledge" tcmId="tcm:142-11170-64" type="page" />
  </siteMapNode>
</siteMap>
Run Code Online (Sandbox Code Playgroud)

到目前为止我做了什么:在PT DWT TBB的脚本标签中创建一个函数.where,pageload(){id ="@@ Page.ID @@"}这个TBB继承了一个(.cs文件),我在一个类中定义了一个id属性.创建此类类型的对象并访问该属性.将此属性用作XSLT参数,并通过xsl应用转换.

任何其他建议都会很好.

Ram*_*m G 5

Manoj,下面的XSL可能有帮助..我没有测试过这个,但是在过去的一些项目中使用它的xml结构略有不同,但下面的代码片段可以帮助你向正前方向前进.

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:template match="/">
        <xsl:for-each select="//siteMapNode[@title = '<<Controls>>']">  ---> Node title of the current page
            <div id="breadcrumb">
                <xsl:for-each select="ancestor::siteMapNode"> --> selects the parent and loop through.. 
                    <a href="@url"><xsl:value-of select="@title"/></a> &gt; --> breadcrumb separator ">"
                </xsl:for-each>
                <xsl:value-of select="@title"/>
            </div>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)