Re: [xsl] Working with entities and notations

Subject: Re: [xsl] Working with entities and notations
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Jul 2011 14:46:30 -0400
Information like the notation of an entity is beyond what the XPath
Data Model deems important enough to include, so I doubt you'll be
able to access it from XSLT.

This looks like an SGML instance, rather than XML, so I imagine you'd
need some sort of proprietary method to apply an XSLT, anyway, such as
might be provided by your SGML editor.  Perhaps some sort of script in
the editor might be a better option for making minor modifications
without losing any of the doctype or entity declaration details.

-Brandon :)


On Wed, Jul 27, 2011 at 5:24 PM,  <dvint@xxxxxxxxx> wrote:
> I havea  sitatuation where I need to process the following content:
>
> <!DOCTYPE dmodule [
> <!ENTITY ICN-GAASIB0-01-32-00-00-G00-0A-0YJB5-00002-B-B-01 SYSTEM
> "ICN-GAASIB0-01-32-00-00-G00-0A-0YJB5-00002-B-B-01.cgm" NDATA cgm>
> <!ENTITY ICN-GAASIB0-01-32-13-01-G00-0A-0YJB5-00001-B-B-01 SYSTEM
> "ICN-GAASIB0-01-32-13-01-G00-0A-0YJB5-00001-B-B-01.cgm" NDATA cgm>
> ]>
> <dmodule>
> <graphic boardno="ICN-GAASIB0-01-32-13-01-G00-0A-0YJB5-00001-B-B-01">
> <graphic boardno="ICN-GAASIB0-01-32-00-00-G00-0A-0YJB5-00002-B-B-01">
> </dmodule>
>
> The <graphic> has the following schema definition:
>
>   <xs:element name="graphic" type="graphicType"/>
>    <xs:complexType name="graphicType">
>        <xs:sequence>
>            <xs:element minOccurs="0" ref="applic"/>
>            <xs:element maxOccurs="unbounded" minOccurs="0" ref="hotspot"/>
>            <xs:element maxOccurs="unbounded" minOccurs="0" ref="rfa"/>
>        </xs:sequence>
>        <xs:attribute ref="refapplic"/>
>        <xs:attribute ref="boardno" use="required"/>
>        <xs:attribute ref="reprowid"/>
>        <xs:attribute ref="reprohgt"/>
>        <xs:attribute ref="reproscl"/>
>        <xs:attributeGroup ref="bodyatt"/>
>        <xs:attributeGroup ref="cntlcontent"/>
>        <xs:attributeGroup ref="secur"/>
>        <xs:attributeGroup ref="xlink:XLINKATT0"/>
>    </xs:complexType>
>
> I can see how unparsed-entity-uri() will get me the SYSTEM information by
> using the boardno attribute on the graphic tag. My problem is that I don't
> see anyway to extract the notation or NDATA value. I know I have at least
> CGM and ISO (IsoDraw) notations that I need to work with, so I can't just
> default to CGM.
>
> I'm trying to convert this XML file and produce a slightly modified one
> without changing the schema or the existing markup. My only thought
> currently is to preprocess with Perl or something - make some new dummy
> tags with the information and then do my actual pass using that info and
> stripping out the intermediate tags. Seems like there should be a better
> way.
>
> ..dan

Current Thread