OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coordination of <script> between SVG, XSLT 1.1 and HTML 4.01



XSLT 1.1, SVG 1.0 and HTML 4.01 define a <script> element, however their current forms are not coordinated.

XSLT 1.1 (http://www.w3.org/TR/xslt11/#define-extension-functions)

<!-- Category: top-level-element -->
<xsl:script
implements-prefix = ncname
language = "ecmascript" | "javascript" | "java" | qname-but-not-ncname
src = uri-reference
archive = uri-references>
<!-- Content: #PCDATA -->
</xsl:script>

HTML 4.01 http://www.w3.org/TR/1999/REC-html401-19991224/interact/scripts.html#h-18.2.1

<!ELEMENT SCRIPT - - %Script;          -- script statements -->
<!ATTLIST SCRIPT
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #REQUIRED -- content type of script language --
  src         %URI;          #IMPLIED  -- URI for an external script --
  defer       (defer)        #IMPLIED  -- UA may defer execution of script --
  event       CDATA          #IMPLIED  -- reserved for possible future use --
  for         %URI;          #IMPLIED  -- reserved for possible future use --
  >

SVG 1.0 http://www.w3.org/TR/SVG/script.html

<!ELEMENT script (#PCDATA) >
<!ATTLIST script
  %stdAttrs;
  %xlinkRefAttrs;
  xlink:href %URI; #IMPLIED
  externalResourcesRequired %Boolean; #IMPLIED
  type %ContentType; #REQUIRED
>

--------------

Both HTML 4.01 and SVG 1.0 depend on a required type attribute containting a MIME type that indicates the type of script ("text/ecmascript" for example).  XSLT 1.1 proposes a language attribute with a
qname/enumeration union type.  HTML 4.01 deprecates a "language" attribute in preference to the "type" attribute.

Changing XSLT 1.1 to use a type attribute contain a MIME type would seem to be the best approach.  I haven't found a MIME registry equivalent to the URI schema registry at http://www.w3.org/Addressing
and if someone knows of one please let me know.  However, I assume that you could use "text/java" or "text/cpp" for Java or C++ source and "application/java" or something similar for Java bytecode or
JAR's.  It would seem that the "archive" attribute would be unnecessary if there were distinct MIME types for a Java .jar or Win32 library.

Both HTML 4.01 and XSLT 1.1 use a src attribute if the script is contained in an external resource, SVG uses xlink:href.  Either SVG should be changed to use "src" or XSLT 1.1 should be changed to use
xlink:href.

XSLT 1.1 has the requirement that redundant implementations of the same behavior can be specified so that one stylesheet could be executed as long as one of the script types were supported.  This is
accomplished by only loading one script element that has a particular implements-prefix value.

It would be useful if SVG could identify specific script elements as being redundant implementations.  If you attempted to cover all your bases providing <script> elements in ECMAScript, VBScript and
Java, a processor that implemented multiple scripting languages would run them all.

The idea of associating a script element with a specific URI (ala XSLT) is probably the right approach.  However, namespace prefixes are too fragile to use to use in SVG.

Possibly, an implements attribute that has a URI value would work both for XSLT and SVG.  In both SVG and XSLT, if there are multiple <script> elements with the same value for implements, only one
would be loaded.  In SVG, the implements attribute would be optional and all script elements without an implements attribute would be executed.

A <script type="application/java"> in SVG might be implemented by invoking a constructor of the specific class that takes a SVGScriptElement as an argument.  Any public properties or methods of the
class would be added to the environment.