I've been trying to figure out this XSLT/XML problem for the past few days (it's code I have the pleasure of trying to fix). Using XSLT, am grabbing what's in the XML tags "see" and trying to create a "see also" (or related files) ALink menu in the Windows Help File with the tags. The $filename is a global variable, so say this is somefile.xml, the $filename would be somefile.xml.
The actual problem lies when I try to link the file together to create the ALink. ( {$filename}_SEE_ALSO gets linked to node()_SEE_ALSO}, the files do get linked... but reversed. So say you have Function X, you want it to show Function Y in the "See Also". Normally, you would put <see>Function Y</see>
in Function X's file (so Function X->Function Y). In the code below, however, what it does is show Function X in Function Y (Function X<-Function Y) - so in reverse. So when you click on Function X's "See also", you get a blank popup, whilst in Function Y, it would pop up with "Function X".
These are the XML tags:
<function>
<showSeeAlso>
<see>Tag1</see>
<see>Tag2</see>
<see>Tag3</see>
</showSeeAlso>
</function>
This is the XSLT:
<xsl:template match="showSeeAlso">
<object id="seeAlso" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="HHCTRL.ocx#Version=4,72,8252,0">
<param name="Command" value="ALink, MENU"/>
<param name="Text" value="Text:See Also"/>
<param name="Font" value="Arial,8pt,,,underline"/>
<param name="Flags" value="1"/>
<param name="Item1" value=""/>
<param name="Item2" value="{$filename}_SEE_ALSO"/>
</object>
<xsl:apply-templates select="see"/>
</xsl:template>
<xsl:template match="see">
<xsl:param name="name" select="."/>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="ALink Name" value="{concat(node(),'_SEE_ALSO')}"/>
</object>
</xsl:template>
Any/all help greatly appreciated, this has been the bane of my existence the past few days.
I don't know if this is going to help anyone else, but I semi-figured out a solution. I switched from ALinks to Related Topics, and fixed up the code. Here's the result:
The XML:
<showSeeAlso/>
<see>tag1</see>
<see>tag2</see>
<see>tag3</see>
The XSLT:
<xsl:if test="showSeeAlso">
<object id="hhctrl" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="hhctrl.ocx#Version=6,1,7600,16385">
<param name="Command" value="Related Topics, DIALOG"/>
<param name="Text" value="Text:See Also"/>
<xsl:apply-templates select="see"/>
</object>
</xsl:if>
<xsl:template match="see">
<xsl:variable name="tag" select="."/>
<xsl:variable name="count">
<xsl:number/>
</xsl:variable>
<param name="Item{$count}" value="{$tag};{$tag}.html"/>
</xsl:template>