RE: Generic XSLTs for extracting / hiding documentation embedded in XML?

Subject: RE: Generic XSLTs for extracting / hiding documentation embedded in XML?
From: <mbaker -at- analecta -dot- com>
To: "'Michael Hopwood'" <Michael -dot- Hopwood -at- Gleif -dot- org>, "'TECHWR-L'" <techwr-l -at- lists -dot- techwr-l -dot- com>
Date: Wed, 24 Aug 2016 10:08:21 -0400

Try this (untested):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
exclude-result-prefixes="xs"
version="1.0">

<xsl:output method="text"/>

<xsl:template match="//xs:documentation">
<div>
<xsl:copy-of select="*"/>
</div>
</xsl:template>

<xsl:template match="*" priority="-1"/>

</xsl:stylesheet>

Mark

-----Original Message-----
From: Michael Hopwood [mailto:Michael -dot- Hopwood -at- Gleif -dot- org]
Sent: Wednesday, August 24, 2016 3:49 AM
To: mbaker -at- analecta -dot- com; TECHWR-L <techwr-l -at- lists -dot- techwr-l -dot- com>
Subject: Re: Generic XSLTs for extracting / hiding documentation embedded in XML?

âsorry, one final question : - )

In the first stylesheet, to extract the xs:documentation tagsâ contents, I am losing some text that is containing in HTML tags (these were added to give presentation to the docs that oXygen outputs).

Is there a shorthand way to make the first stylesheet include HTML contained in the xs:documentation tags?

Best wishes,

Michael

From: "mbaker -at- analecta -dot- com" <mbaker -at- analecta -dot- com>
Date: Tuesday, August 23, 2016 at 8:57 PM
To: Michael Hopwood <Michael -dot- Hopwood -at- Gleif -dot- org>, TECHWR-L <techwr-l -at- lists -dot- techwr-l -dot- com>
Subject: RE: Generic XSLTs for extracting / hiding documentation embedded in XML?

To extract the content of xs:documentation tags:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
exclude-result-prefixes="xs"
version="1.0">

<xsl:output method="text"/>

<xsl:template match="// xs:documentation/text()">
<xsl:if test="normalize-space(.)">
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>&#13;</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match="text()" priority="-1"/>

</xsl:stylesheet>


To process the rest of the content while suppressing the xs:documentation and xs:annotation tags, create a stylesheet that contains the following templates:

<xs:template match="xs:documentation"/>
<xs:template match="xs:annotation"/>

And then import the stylesheet that normally processes the content. Process your content with this new stylesheet. The two templates above will suppress any processing of those elements that the normal stylesheets do while otherwise processing it in exactly the same way they always did.

The latter is untested.

Hope this helps,

Mark



-----Original Message-----
From: techwr-l-bounces+mbaker=analecta -dot- com -at- lists -dot- techwr-l -dot- com [mailto:techwr-l-bounces+mbaker=analecta -dot- com -at- lists -dot- techwr-l -dot- com] On Behalf Of Michael Hopwood
Sent: Tuesday, August 23, 2016 11:50 AM
To: TECHWR-L <techwr-l -at- lists -dot- techwr-l -dot- com>
Subject: Generic XSLTs for extracting / hiding documentation embedded in XML?

Hello all,

I hope this is not too much of a niche question, but I imagine many of you are far more seasoned oXygen users than I am.

Iâm writing documentation into an XML schema using xs:annotation and xs:documentation and oXygen outputs that beautifully.

Now, if I want to just extract the content of the xs:documentation tags as plain text for an ad-hoc use e.g. pasting into a Word doc that can be reviewed, commented etc.?

Conversely, if Iâd like to generate just the outer XML without any xs:annotation and xs:documentation tags?

Would it be too optimistic to think that there might be some tried and tested XML stylesheets available for these purposes? I donât see this being technically intractable. Just asking before I reinvent this wheel.

Best wishes,

Michael Hopwood
Technical Writer

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Global Legal Entity Identifier Foundation (GLEIF) BÃumleingasse 22, 4051, Basel, Switzerland Chairman of the Board: Gerard Hartsink
CEO: Stephan Wolf

This message may contain confidential and/or privileged information. If you are not the intended recipient or if you have received this message in error, please notify the sender and delete this message. Any unauthorised copying, disclosure or distribution of this message is strictly forbidden.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Visit TechWhirl for the latest on content technology, content strategy and content development | http://techwhirl.com

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

You are currently subscribed to TECHWR-L as mbaker -at- analecta -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-leave -at- lists -dot- techwr-l -dot- com


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

Looking for articles on Technical Communications? Head over to our online magazine at http://techwhirl.com

Looking for the archived Techwr-l email discussions? Search our public email archives @ http://techwr-l.com/archives




^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Visit TechWhirl for the latest on content technology, content strategy and content development | http://techwhirl.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-leave -at- lists -dot- techwr-l -dot- com


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

Looking for articles on Technical Communications? Head over to our online magazine at http://techwhirl.com

Looking for the archived Techwr-l email discussions? Search our public email archives @ http://techwr-l.com/archives


Follow-Ups:

References:
Generic XSLTs for extracting / hiding documentation embedded in XML?: From: Michael Hopwood
RE: Generic XSLTs for extracting / hiding documentation embedded in XML?: From: mbaker
Re: Generic XSLTs for extracting / hiding documentation embedded in XML?: From: Michael Hopwood

Previous by Author: RE: Generic XSLTs for extracting / hiding documentation embedded in XML?
Next by Author: RE: Generic XSLTs for extracting / hiding documentation embedded in XML?
Previous by Thread: Re: Generic XSLTs for extracting / hiding documentation embedded in XML?
Next by Thread: RE: Generic XSLTs for extracting / hiding documentation embedded in XML?


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


Sponsored Ads