Custom Sandcastle htmlBody Transform Stylesheet

Nov 23, 2011 at 2:55 AM

I'm trying to modify the htmlBody.xsl file provided with Sandcastle so that at the top of every HTML page, I can have a "Direct Link" a element added which links to our public website with that document.

For example, the new HTML could would be:

<a href="{$topicId}.htm">Direct Link</a>

Where {$topicId} would be something like: 0e26de78-610d-5924-1161-813a2380fe3c (the GUID assigned to the generated HTML file). I've tried using @id and @topicId but these both appear to be undefined / empty. Most other IDs I've found probing around the XML aren't in anything close to that form.

Any help would be GREATLY appreciated.


Nov 23, 2011 at 3:02 AM

With time, maintaining the styles will be another issue you will have to deal with.

I will recommend you use custom components to handle this, just as custom components
are used to handle adding logo to the non-scrollable header.

Best regards,

Nov 23, 2011 at 3:18 AM

Thanks for the response Paul.

I'd rather NOT go down the route of a custom component because we've made other changes to the styles anyways.

Is there a way to do this with the XSL files? If so, any advise?

If not, is there an example you can point me to for custom component development? We're using SHFB.

Nov 23, 2011 at 4:39 AM

The topic identifier is stored as the parameter key. You can refer to it any where as $key.

You can find it defined in utilities_reference.xsl for references and main_conceptual.xsl for conceptual topics.

Best regards,

Nov 23, 2011 at 6:39 AM

Thanks, I appreciate the prompt responses and help!

Dec 12, 2011 at 8:01 AM

Thanks for your help, but in working with this, I've found that $key contains the value I expect for topics specified in our SFHB .content file, but in the documentation generated from the .xml file itself, it includes something like T:MyNameSpace.MyClass instead of 0e26de78-610d-5924-1161-813a2380fe3c.

How do I get the GUID of the HTML file which is to be put into CHM file instead?

Thanks for your assistance.

Dec 12, 2011 at 8:33 AM

For the references, the file name can be retrieved as {/document/reference/file/@name}

Again, see the utilities_reference.xsl to see how that is done.

Best regards,

Dec 12, 2011 at 5:45 PM

Thank you again for your help!