Created on: 2009-11-25 12:14:41
The content.xsl file attached doesn't seem to have the customizations from the earlier version. Is it handled differently? In the previous version it was possible to use a <xsl:import href="wwtransform:super" /> line: is this still valid?
Yes, Malcolm. You can continue to use the <xsl:import href="wwtransform:super" /> approach as well.
It would be extremely helpful if the attached code samples could be extended to support multiple equation objects (and other text/content) in paragraphs.
Also, it might be useful to make it clearer which versions of the base files were overridden (those from WWeP 2009.3, or some other version?)
What exactly do you mean by "extended to support multiple equation objects"?
Thanks for your quick response. Sorry that wasn't clear from my comment alone. I was referring to the Caveats section that I added to the end of the page:
“This solution assumes only one equation will be present in each paragraph. In cases where several equation objects are included in the same paragraph, only the first equation is rendered. (Without this customization, both/all appear.)”
Unfortunately, our documents contain many such instances where the equation is not the only thing in the paragraph, and everything else is lost with this customization.
You can probably make this work for all of them by adding in a for-each loop.
<xsl:variable name="VarWifFrameId" select="$ParamParagraph/descendant::wwdoc:Frame/@id"/> ...
Do something like:
<xsl:for-each select="$ParamParagraph/descendant::wwdoc:Frame"> <xsl:variable name="VarWifFrameId" select="./@id"/> ... </xsl:for-each>
Chris left an earlier comment that I'm having trouble finding now. Anyway, here it is.
I have a different problem. I have implemented the customization and now have the equation numbers plced correctly on the right. However, for some equations, the wrong graphic is being displayed. The right graphic exists with the right name in the images folder, but the wrong graphic, randomly selected from elsewhere in the document, has been referenced in the HTML.
The problem is due to an error in the original code which failed to ensure that image IDs were qualified by their original document ID. This is the line that needs to be changed:
<xsl:variable name="VarSplitsFrame" select="key('wwsplits-frames-by-id', $VarWifFrameId)[@documentID = $ParamSplit/@documentID]"/>
Ben (or anyone else),
- Will this approach still work with the upcoming 2010.3 release?
Also, any ideas on how to address the cases with mixed content (several equations interspersed with text in a single paragraph):
Your for-each suggestion above was a step in the right direction, but it discards all non-equation paragraph content. Can this approach be modified to include everything that appears in the paragraph within the left cell of the table?
I'm returning to this issue for a new release of my client's product, and the client views this issue as critical--would like to be able to offer them a solution.
In answer to your questions...
#1 Yes, this approach should still work with current versions of the product.
#2 <xsl:for-each> gets you only so far. As you point out, you still want to preserve other content within the paragraph. I'd suggest you bring this problem to a Study Hall session with JesseWiles. Very likely it can be resolved in that context.
I put together an example of the override based on the requirements you enumerated. It is available at the following link: Equations-fromJesse-011210.zip. Does this fit your needs?
Thanks for putting this together and explaining it in the January 12 Study Hall session.
I have 2 questions:
1. When tested in WWeP 2010.3, it works fine by itself, but our project contains another customization to the HTML Help content.xsl transform that we use to add headings to MiniTOCs as described in http://wiki.webworks.com/HelpCenter/Tips/AddingHeadingsToMiniTOCs.
I copied the modified MiniTOC template in to your version of the file (see attached customized-content.xsl.zip), but this approach is apparently not compatible with the new super override technique, as the following errors appeared:
[Error] Error occurred while reading tranform 'wwformat:Transforms\popups.xsl' from file 'C:\path\to\project\Formats\Microsoft HTML Help 1.x.base\Transforms\popups.xsl'. [Error] Prefix 'wwtoc' is not defined.
Can you point me in the right direction as to how to implement both the MiniTOC headers and the equation fix in the same project?
2. The equation fix works fine for paras of style 'Equations w/number, catalog', but it turns out the same exact approach needs to be applied to paras of style 'Equations w/number 1, catalog' as well. Is there a way to add some sort of 'OR' statement to the stylename matching so that it will catch both cases, or do I need to duplicate the entire template for the second style?
Thanks again for your help, we're very close to a solution!
You were definitely on the right track. I think you were only missing a namespace declaration. I attached an updated version of the file: customized-content_xsl_fromJesse_012511.xsl. Please give it a try and let us know what you find.
Thanks for your quick response, your modified version of the content.xsl file worked like a charm, the equations are now rendered like we want!
After further testing, I noticed a side effect though: cross-references to numbered equations no longer work.
It appears the custom XSL code strips the anchors, so the DIVs with the equation numbers only include the paranums, but not the anchors that are typically created when a numbered equation para contains a cross-reference marker in FM, so links like "see equation (5)" no longer work.
The output HTML is now this:
instead of this:
<div style="...">(5)<a name="1748159"></div>
What would I need to change in the XSL code to make sure the anchors survive the transformation?
Thanks again for your help,