[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: DTD entities in XSLT

Subject: Re: DTD entities in XSLT
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Aug 2020 11:26:51 -0000
Re:  DTD entities in XSLT
> Thanks. Will this work in Saxon-HE? I'm looking for a solution that
> could be used in open-source code.

Yes, of course. There's nothing in the query "." that needs EE capabilities!

You could also, of course, use a Java identity transformer
(TransformerFactory.newProcessor()), which might be faster as it's fully
streamed.

Michael Kay
Saxonica
>
> On Mon, Aug 24, 2020 at 1:15 PM Michael Kay mike@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> Well, you could run the XQuery "." on Java, which would give you a document
in which all the entity references are expanded.
>>
>> java net.sf.saxon.Query -qs:"." -s:in.xml -o:out.xml
>>
>> Michael Kay
>> Saxonica
>>
>>
>>
>> On 24 Aug 2020, at 12:07, Martynas JuseviD
ius martynas@xxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> Hi,
>>
>> trying to set up Saxon-JS 2 I hit a snag immediately, but I think the
>> question is general enough for this list.
>>
>> The problem is DTD entities. Saxon-JS 2 documentation says:
>> "The XML parser used on Node.js skips any internal or external DTD.
>> Any named entity references appearing in a document will therefore be
>> flagged as errors, causing parsing (and hence transformation) to
>> fail."
>>
>> Sure enough, when trying to generate the SEF file, I get an error:
>>
>> Failed to compile stylesheet: Reference to unknown entity &typeahead;
>> at line 32 column 28
>> Error FODC0002
>>   Failed to compile stylesheet
>> Error FODC0002
>>   Reference to unknown entity &typeahead; at line 32 column 28
>>
>> And all our stylesheets use a bunch of internal DTD entities (example
below).
>> Would it be possible to somehow pre-process them and inline the
>> entities, so that I can keep them in the source file and still make
>> Saxon-JS happy?
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE xsl:stylesheet [
>>   <!ENTITY typeahead  "http://graphity.org/typeahead#">
>>   <!ENTITY lapp
"https://w3id.org/atomgraph/linkeddatahub/apps/domain#">
>>   <!ENTITY apl        "https://w3id.org/atomgraph/linkeddatahub/domain#">
>>   <!ENTITY ac         "https://w3id.org/atomgraph/client#">
>>   <!ENTITY a          "https://w3id.org/atomgraph/core#">
>>   <!ENTITY rdf        "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>>   <!ENTITY rdfs       "http://www.w3.org/2000/01/rdf-schema#">
>>   <!ENTITY xsd        "http://www.w3.org/2001/XMLSchema#">
>>   <!ENTITY owl        "http://www.w3.org/2002/07/owl#">
>>   <!ENTITY skos       "http://www.w3.org/2004/02/skos/core#">
>>   <!ENTITY srx        "http://www.w3.org/2005/sparql-results#">
>>   <!ENTITY http       "http://www.w3.org/2011/http#">
>>   <!ENTITY ldt        "https://www.w3.org/ns/ldt#">
>>   <!ENTITY c          "https://www.w3.org/ns/ldt/core/domain#">
>>   <!ENTITY dh
"https://www.w3.org/ns/ldt/document-hierarchy/domain#">
>>   <!ENTITY sd         "http://www.w3.org/ns/sparql-service-description#">
>>   <!ENTITY sp         "http://spinrdf.org/sp#">
>>   <!ENTITY spin       "http://spinrdf.org/spin#">
>>   <!ENTITY dct        "http://purl.org/dc/terms/">
>>   <!ENTITY foaf       "http://xmlns.com/foaf/0.1/">
>>   <!ENTITY sioc       "http://rdfs.org/sioc/ns#">
>> ]>
>> <xsl:stylesheet
>> xmlns:xhtml="http://www.w3.org/1999/xhtml"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
>> xmlns:prop="http://saxonica.com/ns/html-property"
>> xmlns:style="http://saxonica.com/ns/html-style-property"
>> xmlns:js="http://saxonica.com/ns/globalJS"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:typeahead="&typeahead;"
>> xmlns:a="&a;"
>> xmlns:ac="&ac;"
>> xmlns:lapp="&lapp;"
>> xmlns:apl="&apl;"
>> xmlns:rdf="&rdf;"
>> xmlns:rdfs="&rdfs;"
>> xmlns:owl="&owl;"
>> xmlns:ldt="&ldt;"
>> xmlns:core="&c;"
>> xmlns:dh="&dh;"
>> xmlns:srx="&srx;"
>> xmlns:sd="&sd;"
>> xmlns:sp="&sp;"
>> xmlns:spin="&spin;"
>> xmlns:dct="&dct;"
>> xmlns:foaf="&foaf;"
>> xmlns:sioc="&sioc;"
>> xmlns:skos="&skos;"
>> xmlns:bs2="http://graphity.org/xsl/bootstrap/2.3.2"
>> exclude-result-prefixes="xs prop"
>> extension-element-prefixes="ixsl"
>> version="2.0"
>>
>>
>>
>>
>> Martynas
>>
>>
>> XSL-List info and archive
>> EasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.