RE: Use of XLST to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output

Subject: RE: Use of XLST to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output
From: "Porrello, Leonard" <lporrello -at- illumina -dot- com>
To: 'Richard L Hamilton' <dick -at- rlhamilton -dot- net>, "techwr-l -at- lists -dot- techwr-l -dot- com" <techwr-l -at- lists -dot- techwr-l -dot- com>
Date: Tue, 9 Aug 2011 20:39:40 +0000

Thank you!

-----Original Message-----
From: techwr-l-bounces+lporrello=illumina -dot- com -at- lists -dot- techwr-l -dot- com [mailto:techwr-l-bounces+lporrello=illumina -dot- com -at- lists -dot- techwr-l -dot- com] On Behalf Of Richard L Hamilton
Sent: Monday, August 08, 2011 5:14 PM
To: techwr-l -at- lists -dot- techwr-l -dot- com
Subject: Re: Use of XLST to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output

Leonard,

You're right that, in general, you're going to have trouble using XSLT on HTML files. However, the example you included is XHTML, which you can handle with XSLT. Here's a quick try at a stylesheet that will remove any MadCap prefixed elements or attributes (I'm not guaranteeing anything, but it worked on your example below):

==============
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns="http://www.w3.org/1999/xhtml";
xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd";>

<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<!-- get rid of MadCap prefixed elements and attributes, respectively -->
<xsl:template match="MadCap:*"/>
<xsl:template match="@MadCap:*"/>

<!-- Identity transform for everything else -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
======================

A couple of caveats:

1) You will either need to have the schema for MadCap available, or choose a no-validation option on your xsl processor (the latter is easier and reasonably safe, since I suspect Flare generates clean XML). For xsltproc, you would use the --novalid option.
2) This stylesheet leaves in the MadCap namespace declaration, even though the namespace doesn't occur in the result. There's probably a way to get rid of it, but I don't know off-hand how to do that. If it's important, you can always strip it out by hand or using something like perl.

Hope that helps.

Richard Hamilton
-------
XML Press
New from XML Press:
The Secret Life of Word: A Professional Writer's Guide to Microsoft Word Automation
http://xmlpress.net/publications/word-secrets

On Aug 8, 2011, at 2:26 PM, Porrello, Leonard wrote:

> As far as I can tell, you can use XSLT only to convert/transform XML files, so I am not sure how it would work for Flare or Flare output. Help? Anyone?
>
> -----Original Message-----
> From: Porrello, Leonard
> Sent: Monday, August 08, 2011 9:10 AM
> To: 'Mark Giffin'
> Cc: techwr-l -at- lists -dot- techwr-l -dot- com
> Subject: RE: Unadulterated Flare HTML/XML output
>
> Thanks for the tip, Mark. We want to use Flare to single-source end user docs as well as content for an online "portal." In the end user docs MadCap tags are not a problem, but the content in the portal cannot have MadCap tags.
>
> I'd not heard of XSLT before you sent your note, so I hope you forgive the naiveté of my question. Would you do the "identity transform" on normal generated WebHelp output?
>
>
> -----Original Message-----
> From: Mark Giffin [mailto:mgiffin -at- earthlink -dot- net]
> Sent: Saturday, August 06, 2011 8:23 PM
> To: Porrello, Leonard
> Cc: techwr-l -at- lists -dot- techwr-l -dot- com
> Subject: Re: Unadulterated Flare HTML/XML output
>
> Leonard,
>
> I see what you mean, but I guess I wouldn't call those proprietary,
> because they use a standard XML namespace:
> xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd";. Of
> course, MadCap does not provide the full schema if you wanted to
> validate their files in a real XML editor (I've tried to get the schema
> over the last couple years), so maybe they are proprietary. If you want
> to see real proprietary HTML, go back to the old RoboHelp days.
>
> Anyway, you could use XSLT to remove the MadCap stuff. I don't think it
> would be real complicated if you knew XSLT. I would use an "identity
> transform" to copy the entire contents of the file, plus a few templates
> to snuff out the MadCap bits.
>
> Why do you need to remove them?
>
> Mark Giffin
> http://www.markgiffin.com
>
>
> On 8/5/2011 12:25 PM, Porrello, Leonard wrote:
>> There's the header info:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd"; MadCap:lastBlockDepth="7" MadCap:lastHeight="211" MadCap:lastWidth="808" MadCap:disableMasterStylesheet="true" MadCap:tocPath="" MadCap:medium="OLH" MadCap:InPreviewMode="false" MadCap:PreloadImages="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" lang="en-us" xml:lang="en-us" MadCap:PathToHelpSystem="../../../../" MadCap:HelpSystemFileName="Default.xml" MadCap:SearchType="Stem">
>>
>> And then there is inline stuff:
>>
>> <td class="AutoNumber_p_Bullet1" MadCap:autonum="&lt;span style=&quot;color: #b7b7b7;&quot; class=&quot;mcFormatColor&quot;&gt;*&lt;/span&gt;" valign="top"><b>Coordinates</b> based on start and stop bp range for chromosomes</td>
>>
>> <p class="TblTitle" MadCap:conditions="" MadCap:autonum="Table 47&#160;&#160;" MadCap:xrefTargetName="Table_47_&#160;&#160;Manage_Targets_Tab_Options"><a MadCap:generatedBookmark="ListOf" name="Table_47_&#160;&#160;Manage_Targets_Tab_Options"></a><span class="autonumber"><span class="KeyColorBold">Table 47&#160;&#160;</span></span>Manage Targets Tab Options</p>
>>
>> <script type="text/javascript" src="../../../SkinSupport/MadCapBodyEnd.js">
>>
>> -----Original Message-----
>> From: techwr-l-bounces+lporrello=illumina -dot- com -at- lists -dot- techwr-l -dot- com [mailto:techwr-l-bounces+lporrello=illumina -dot- com -at- lists -dot- techwr-l -dot- com] On Behalf Of Robert Lauriston
>> Sent: Thursday, August 04, 2011 3:35 PM
>> To: techwr-l -at- lists -dot- techwr-l -dot- com
>> Subject: Re: Unadulterated Flare HTML/XML output
>>
>> Such as what? Looking at the HTML files in the Content directory of my
>> Flare 7.1 WebHelp output, I don't see any proprietary tags.
>>
>> On Thu, Aug 4, 2011 at 2:07 PM, Porrello, Leonard
>> <lporrello -at- illumina -dot- com> wrote:
>>> Does anyone know how to get HTML or XML files out of Flare that are free from proprietary Flare tags?
>>
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Create and publish documentation through multiple channels with Doc-To-Help.
> Choose your authoring formats and get any output you may need. Try
> Doc-To-Help, now with MS SharePoint integration, free for 30-days.
> http://www.doctohelp.com
>
> ---
> You are currently subscribed to TECHWR-L as dick -at- rlhamilton -dot- net -dot-
>
> To unsubscribe send a blank email to
> techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
> or visit http://lists.techwr-l.com/mailman/options/techwr-l/dick%40rlhamilton.net
>
>
> To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com
>
> Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit
> http://www.techwr-l.com/ for more resources and info.
>
> Please move off-topic discussions to the Chat list, at:
> http://lists.techwr-l.com/mailman/listinfo/techwr-l-chat
>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Create and publish documentation through multiple channels with Doc-To-Help.
Choose your authoring formats and get any output you may need. Try
Doc-To-Help, now with MS SharePoint integration, free for 30-days.
http://www.doctohelp.com

---
You are currently subscribed to TECHWR-L as lporrello -at- illumina -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/lporrello%40illumina.com


To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com

Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit
http://www.techwr-l.com/ for more resources and info.

Please move off-topic discussions to the Chat list, at:
http://lists.techwr-l.com/mailman/listinfo/techwr-l-chat

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Create and publish documentation through multiple channels with Doc-To-Help.
Choose your authoring formats and get any output you may need. Try
Doc-To-Help, now with MS SharePoint integration, free for 30-days.
http://www.doctohelp.com

---
You are currently subscribed to TECHWR-L as archive -at- web -dot- techwr-l -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/archive%40web.techwr-l.com


To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com

Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit
http://www.techwr-l.com/ for more resources and info.

Please move off-topic discussions to the Chat list, at:
http://lists.techwr-l.com/mailman/listinfo/techwr-l-chat


References:
Anyone out there working with browser-based help with Japanese text?: From: Wroblewski, Victoria
Unadulterated Flare HTML/XML output: From: Porrello, Leonard
Re: Unadulterated Flare HTML/XML output: From: Robert Lauriston
RE: Unadulterated Flare HTML/XML output: From: Porrello, Leonard
Re: Unadulterated Flare HTML/XML output: From: Mark Giffin
RE: Unadulterated Flare HTML/XML output: From: Porrello, Leonard
Use of XLST to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output: From: Porrello, Leonard
Re: Use of XLST to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output: From: Richard L Hamilton

Previous by Author: Use of XSLT to clean up MadCap HTML; RE: Unadulterated Flare HTML/XML output
Next by Author: Re: Recommendations for good website shared hosting service?
Previous by Thread: Re: Use of XLST to clean up MadCap HTML
Next by Thread: Re: Unadulterated Flare HTML/XML output


What this post helpful? Share it with friends and colleagues:


Sponsored Ads