Process paragraphs with JScript .NET
Version |
Date |
Changes |
1.0 |
2010-08-15 |
Initial version. |
Description
This page details an override which demonstrates processing content paragraphs with JScript .NET.
The Override
Attached is a project which includes an override of the Dynamic HTML context.xsl(JScript.zip), which demonstrates this override.
Notes
While similar to Javascript and while it uses mostly ECMAScript syntax, there are some differences between JScript .NET and Javascript. This article provides a good starting point.
This override using a msxsl:script element and the JScript .NET language to process paragraphs.
<msxsl:script implements-prefix="wwscript" language="JScript">
The override uses the wwtransform:super resolver, which is detailed in this article. By using the wwtransform:super resolver, this override is insulated from the usual risks associated with overriding with regard to updating to new ePublisher versions.
<xsl:import href="wwtransform:super" />
The override demonstrates using the wwwadapter resolver for adding references to assemblies in the WebWorks namespace.
<msxsl:assembly href="wwassembly:WebWorks.Common" /> ... <msxsl:using namespace="WebWorks.Common.Xsl.Extension" />
- Adding this reference and using directive makes the native ePublisher Log facilities available within the script block. This is useful for debugging.
// Log object. Use this object's Info, Warning, and Error methods to write messages // to the ePublisher log. Refer to the following wiki page for documentation on the Log // object: http://wiki.webworks.com/DevCenter/Documentation/ExtensionObjects#log // var Logger = new Log();
- This version doesn't offer much help for resolving "Rules", which are the collection of Properties and Options for a given ePublisher entity, like Paragraph Styles, Character Styles, and so on. The rule is consulted for determined the HTML tag that is used for the Paragraph element, and the Rules are not used at all for Character styles. Support for this may be added later.
The attached project includes source files for each of the three input adapter types supported by ePublisher (FrameMaker, Microsoft Word, DITA).