Cover Pages Logo SEARCH
Advanced Search
ABOUT
Site Map
CP RSS Channel
Contact Us
Sponsoring CP
About Our Sponsors

NEWS
Cover Stories
Articles & Papers
Press Releases

CORE STANDARDS
XML
SGML
Schemas
XSL/XSLT/XPath
XLink
XML Query
CSS
SVG

TECHNOLOGY REPORTS
XML Applications
General Apps
Government Apps
Academic Apps

EVENTS
LIBRARY
Introductions
FAQs
Bibliography
Technology and Society
Semantics
Tech Topics
Software
Related Standards
Historic

XT and Emacs/psgml: incompatible SYSTEM identifiers


From:     David Megginson <david@megginson.com>
Subject:  Re: XT and Emacs/psgml: incompatible SYSTEM identifiers
Date:     14 Oct 1999 17:36:33 -0400

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Grossjohann) writes:

 > I'm trying to edit XML files with the psgml Emacs mode, and I'm trying
 > to convert these XML files to HTML using James Clark's XT
 > implementation of XSLT.
 >
 > Psgml expects the SYSTEM identifier to be a file name, to be searched
 > for in a list of directories.
 >
 > XT expects the SYSTEM identifier to be a URL, which, if relative, is
 > relative to the directory where the XML file is.
 >
 > Apparently, every XML document must have a SYSTEM identifier.  I tried
 > giving both a SYSTEM and a PUBLIC identifier, but that didn't work at
 > all: psgml didn't seem to find it, and XT emits a syntax error.

[Megginson] This is a significant problem with PSGML -- it should be possible to rewrite it to use the URL support already in Emacs, but in the meantime, I simply add the following to my ~/.emacs -- actually, to ~/.psgml, which ~/.emacs loads:


(defvar sgml-sysid-alist '()
   "Association list of system IDs and actual file paths.")

(defun sgml-insert-mapped-sysid (sysid)
   (let ((mapping (assoc sysid sgml-sysid-alist)))
     (cond (mapping
	   (insert-file (cadr mapping))
	   t)
	  (t nil))))

(setq sgml-sysid-resolve-functions
       (cons (function sgml-insert-mapped-sysid)
	    (and (boundp 'sgml-sysid-resolve-functions)
		 sgml-sysid-resolve-functions)))


(setq sgml-sysid-alist
       '(("http://www.w3.org/TR/xhtml1/DTD/frameset.dtd"
	 "/home/david/sgml/system/XHTML/frameset.dtd")
	("http://www.w3.org/TR/xhtml1/DTD/strict.dtd"
	 "/home/david/sgml/system/XHTML/strict.dtd")
	("http://www.w3.org/TR/xhtml1/DTD/transitional.dtd"
	 "/home/david/sgml/system/XHTML/transitional.dtd")
	("http://www.w3.org/TR/xhtml1/DTD/HTMLlat1x.ent"
	 "/home/david/sgml/system/XHTML/HTMLlat1x.ent")
	("http://www.w3.org/TR/xhtml1/DTD/HTMLsymbolx.ent"
	 "/home/david/sgml/system/XHTML/HTMLsymbolx.ent")
	("http://www.w3.org/TR/xhtml1/DTD/HTMLspecialx.ent"
	 "/home/david/sgml/system/XHTML/HTMLspecialx.ent")
	("http://www.w3.org/1999/05/06-xmlschema-1/structures.dtd"
	 "/home/david/sgml/system/structures.dtd")
	("http://www.w3.org/1999/05/06-xmlschema-2/datatypes.dtd"
	 "/home/david/sgml/system/datatypes.dtd")
	("http://www.xmlnews.org/dtds/xmlnews-story.dtd"
	 "/home/david/projects/XMLNews/dtds/xmlnews-story.dtd")
	("http://www.xmlnews.org/dtds/xmlnews-meta.dtd"
	 "/home/david/projects/XMLNews/dtds/xmlnews-meta.dtd")))

To map other URLs to actual files, just add the mappings to the alist. Of course, a cleaner and more robust solution would be nice, but I manage to live with this for now.

All the best,

David

David Megginson                 david@megginson.com
            http://www.megginson.com/

Prepared by Robin Cover for the The SGML/XML Web Page archive.


Globe Image

Document URL: http://xml.coverpages.org/psgml120FIX.html