Hello,
I'm using Interwoven's TeamSite 6.7.2 to create new Web pages. TS672 uses XSLT 1.0 and Xalan as its processor. This is what I'm trying to do:
I have a number of articles, and some contain references to other snippets of content. This is an example of the native XML from one of data capture templates (forms) that we use:
Code:
<Properties ComponentID="1228170816873" Admin="true">
<Data>
<Datum ID="D01" Type="DCR" Name="My DCR">
<DCR Category="WebKBdocs" Type="KBdoc">
<record name="product\ESR10603" type="content">
<item name="DocType">
<value>KBDOC</value>
</item>
<item name="DocID">
<value>ESR10603</value>
</item>
<item name="Title">
<value>Translating Files</value>
</item>
<item name="ContentArea">
<value>
<item name="Condition" />
<item name="DPList">
<value>
<item name="DPItem">
<value>NODECISIONPOINT</value>
</item>
<item name="DPValue">
<value>yes</value>
</item>
</value>
</item>
<item name="ContentSubSection">
<value>
<item name="ContentType">
<value>general</value>
</item>
<item name="Customers">
<value>ALL</value>
</item>
<item name="ContentSection">
<value><p>Sample article content.</p> <p><snippet class="sniplink" name="SNIP/product/ESRx10094" dcrpath="/default/main/Company/Enterprise/Industry/MainframeSW/WORKAREA/KBContent/templatedata/WebKBdocs/ContentSnippet/data/product/ESRx10094" htmlpath="Y:/default/main/Company/Enterprise/Industry/MainframeSW/WORKAREA/KBContent/preview_files/SNIP/product/ESRx10094.html">Snippet Link ESRx10094</snippet></p> <p><snippet class="sniplink" name="SNIP/product/ESRx10107" dcrpath="/default/main/Company/Enterprise/Industry/MainframeSW/WORKAREA/KBContent/templatedata/WebKBdocs/ContentSnippet/data/product/ESRx10107" htmlpath="Y:/default/main/Company/Enterprise/Industry/MainframeSW/WORKAREA/KBContent/preview_files/SNIP/product/ESRx10107.html">Snippet Link ESRx10107</snippet></p>
</value>
</item>
</value>
</item>
</value>
</item>
</record>
</DCR>
</Datum>
</Data>
</Properties>
Outside of TeamSite, I can use a variable to access the @dcrpath value and then pass it to the document function, and my single-sourced content snippet appears in the article (it doesn't necessarily appear in place of the Snippet Link reference in the ContentSection since I can't use replace() in XSLT1.0, but I'm taking baby steps as I write the stylesheet - right now I just want to access the dcrpath attribute).
This is my XSL that works outside of TeamSite:
Code:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<meta http-equiv="author" content="Jessica DEustachio" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="content-type" content="text/xml;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="../theme/kbcontent.css" />
</head>
<body>
<p class="pagetitle"><xsl:value-of disable-output-escaping="yes" select="/Properties/Data/Datum[@ID='D01']/DCR[@Type='KBdoc']/record/item[@name='Title']/value" /> </p>
<p class="superviewer"><b>SME Information: </b><br />
Doctype: <xsl:value-of disable-output-escaping="yes" select="/Properties/Data/Datum[@ID='D01']/DCR[@Type='KBdoc']/record/item[@name='DocType']/value" /> --
DocID: <xsl:value-of disable-output-escaping="yes" select="/Properties/Data/Datum[@ID='D01']/DCR[@Type='KBdoc']/record/item[@name='DocID']/value" /> --
</p>
<hr />
<xsl:apply-templates select="/Properties/Data/Datum[@ID='D01']/DCR[@Type='KBdoc']/record/item[@name='ContentArea']/value" />
<hr />
</body>
</html>
</xsl:template>
<xsl:template match="/Properties/Data/Datum[@ID='D01']/DCR[@Type='KBdoc']/record/item[@name='ContentArea']/value">
<p class="superviewer"><b>Content Area <xsl:value-of select="count(preceding-sibling::value) + 1"/></b></p>
<xsl:for-each select="item[@name='ContentSubSection']/value">
<xsl:value-of disable-output-escaping="yes" select="item[@name='ContentSection']/value"/>
<br/>
<xsl:variable name="snippetpath">
<xsl:choose>
<xsl:when test="contains(item[@name='ContentSection']/value,'Snippet')" >
<xsl:value-of select="item[@name='ContentSection']/value/p/snippet/@dcrpath"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains(item[@name='ContentSection']/value,'Snippet')" >
<p>
<xsl:copy-of select="document($snippetpath)//Properties/Data/Datum[@ID='D02']/DCR[@Type='ContentSnippet']/record/item[@name='ContentArea']/value/item[@name='ContentSubSection']/value/item[@name='ContentSection']/value"/>
</p>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="item[@name='ContentSection']/value"/>
<br/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- Copy HTML to output without modification -->
<xsl:template match="text()|@*|*">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()"/>
<!--<xsl:value-of disable-output-escaping="yes" select="."/>-->
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When I place a copy of the stylesheet into the TeamSite component for the Web page, it doesn't process the variable. Specifically, everything after Properties/Data/Datum/DCR/record/item[name='ContentArea']/value/item[name='ContentSubSection']/value/item[name='ContentSection']/value is processed as a substring, so I can't get to the @dcrpath unless I convert it to a node set.
I've tried using xalan:nodeset, and it doesn't seem to work. This is what I did to use it, and I'm not sure if I'm using it correctly:
Code:
<xsl:variable name="vfecontent">
<xsl:value-of select="item[@name='ContentSection']/value"/>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="xalan:nodeset($vfecontent)/p/snippet/@dcrpath" />
</xsl:copy>
Given the limitations and the fact that TeamSite sees the content as a substring, does anyone know how I can get the @dcrpath value and pass it to the document function? Once I have it, does anyone have any suggestions on how to replace the Snippet Link reference with the snippet content?
Many thanks in advance.