This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: doctype decl problem




"Pawson, David" wrote:
> 
> I'm trying to transform an SVG document and getting
> totally screwed up with the decl.
> 
> If I understand it right, an xml decl can have a public identifier,
> but then must have a system identifier as well.
> 
> So I cant (as in SGML) say
> 
> <?xml version = "1.0" ?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 03December 1999//EN" >

You have there a prolog, which consists of two things, an xml declaration,
followed by a doctype declaration. It is the latter which has a public and
optionally a system identifier.

[22] prolog  ::=   XMLDecl? Misc* (doctypedecl Misc*)?

> Instead I must say
> 
> <?xml version = "1.0" ?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 03December 1999//EN" SYSTEM
> "http://www.w3.org/Graphics/SVG/SVG-19991203.dtd">

If you remove the SYSTEM bit from that example

[28]  doctypedecl  ::=   '<!DOCTYPE' S Name (S ExternalID)? S? ('['
                          (markupdecl | PEReference | S)* ']' S?)? '>'

[75] ExternalID  ::=  'SYSTEM' S SystemLiteral
                       | 'PUBLIC' S PubidLiteral S SystemLiteral 


> 1. Am I correct in my understanding?
> ( http://www.w3.org/TR/REC-xml#sec-prolog-dtd )

Close but not quite.

> Either way, I have a file which when used with the above prolog shortened to
> 
> <?xml version = "1.0" ?>
> <!DOCTYPE svg  SYSTEM "path/to/myLocalCopyOf/SVG-19991203.dtd">
> 
> No element below the root is triggering any of the templates....
> To be exact, <xsl:template match= "/"> is triggering,
> but the outer container, <svg> is not triggering.

Do your templates check for svg in the SVG namespace, or just any svg
element?
> 
> I checked with Ken Holmans showtree and got a load of 'empty' triggers.
> 
> However... when I remove the doctype line,
> my templates trigger quite happily.
> 
> E.g.
> 
> <?xml version = "1.0" ?>
> <svg x="0" y="0" width="2523.895996" height="667.296005">

You don't have a namespace declaration. You should, for standalone files.
Notice, if you follow the link to the DTD, that it says (among other
things)

<!ATTLIST svg
  xmlns CDATA #FIXED 'http://www.w3.org/Graphics/SVG/SVG-19991203.dtd'

For a standalone document you need to have the namespace or namespaces (SVG
also uses the XLink namespace) declared explicitly.

> When I insert
> <!DOCTYPE svg SYSTEM "../w3c/svg-19991203.dtd">
> Nothing other than the / template triggers.

What about if you use

<?xml version = "1.0" ?>
<svg xmlns="http://www.w3.org/Graphics/SVG/SVG-19991203.dtd"
  x="0" y="0" width="2523.895996" height="667.296005">
and so on
</svg>

--
Chris


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]