xsl-list
[Top] [All Lists]

Re: [xsl] retaining entity declarations while converting from one xml format to another

2009-12-16 21:15:24
Hello everybody:

Thank you for all your help. Michael, yes, I do want entity references
to be copied as is.
I downloaded Kernow. But can you please tell me how I can use it to
achieve my output?

On Wed, Dec 16, 2009 at 3:44 AM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:

Please look at the saxon extension function saxon:doctype.

http://saxon.sourceforge.net/saxon6.5.5/extensions.html#saxon:doctype

which provides the mechanism to create the entities. In your
case you have to re-generate the entities in XML file.

I suspect that he wants entity refe:

rences to be copied, rather than entity
declarations. The saxon:doctype extension allows you to construct a DTD
(internal subset) containing entity declarations, and you can construct
references to those entities using character maps or
disable-output-escaping. But to get access to entity declarations and entity
references in the source XML, you need to stop the XML parser expanding
them, which you can do using Andrew Welch's LexEv.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay



Regards,
Ganesh


On Wed, Dec 16, 2009 at 6:23 AM, David Carlisle
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

I am sorry I forgot to mention one piece of information
here. These
input files were originally SGML and were then converted to well

but assuming spoon.jpg is a jpeg file, the same would apply
in SGML as
well, image entities should be NDATA (not parsed) and referenced as
attribute values, not using &  ; notation.

So when I do the <xsl:copy> the entities are not copied over.

parsed entities (referenced by &) are expanded by the XML parser
before XSLT even sees the input. So XSLT can not copy them
as it never
sees them.

But you can not reference a jpg file that way.

An NDATA entity is referenced as attribute value typically
something
like

<!ENTITY spoon.jpg SYSTEM "spoon.jpg" NDATA jpg>

...
 <image ref="spoon.jpg"/>
...

if you access the entity this way, then the attribute value is
available to xslt and you can look up the SYSTEM URI using
unparsed-entity-uri().


But you showed a parsed entity declaration



<!ENTITY spoon.jpg SYSTEM "spoon.jpg" >

which would be acceessed by

& s p o o n . j p g ;

such a reference would be expanded by the xml parser before
xslt sees
the data (and generate a fatal error if it is a jpeg file
rather than
xml)

As you haven't shown how you are referencing the entities in the
source file I can't really guess what to suggest.

david


______________________________________________________________________
__ The Numerical Algorithms Group Ltd is a company registered in
England and Wales with company number 1249803. The
registered office
is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The
service is
powered by MessageLabs.

______________________________________________________________________
__


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>