xslp-faq
[1]XSL:P/
XSL:P/ Frequently Asked Questions
19990326
1. [2]I am trying to transform XML into HTML, but my browser doesn't
like certain empty tags, like <BR/>. What can I do to fix this?
2. [3]Does XSL:P support any scripting or Extensibility mechanism?
3. [4]Does XSL:P support any non-standard features?
4. [5]I am having trouble compiling XSL:P, what could be the problem?
_________________________________________________________________
1. I am trying to transform XML into HTML, but my browser doesn't
like certain empty tags, like <BR/>. What can I do to fix this?
XSL:P uses the empty element shorthand by default when printing
the result tree. If you want XSL:P to print HTML you can set the
result-ns attribute of the stylesheet to equal "html" or start
with "http://www.w3.org/TR/REC-html".
Note: These values are case sensitive.
Example:
<xsl:stylesheet result-ns="http://www.w3.org/TR/REC-html">
Using this will cause XSL:P/ to supress ending tags for
<BR>,<HR>,<IMG>, and <P> when it has no child nodes. Other tags
with no children will be printed using both start and end tags.
2. Does XSL:P support any scripting or Extensibility mechanism?
Yes. XSL:P has ECMAScript support. Use the xsl:script element to
access the scripting environment. You may use the "this" keyword
to reference the current element. All Elements are DOM Elements.
Functions may be declared by using xsl:script elements as
immediate children of the xsl:stylesheet. Any xsl:script elements
that are descendants of xsl:template will be locally scoped to the
current context.
The following simple example counts the number of children of the
current element:
<xsl:script>
<![CDATA[
return "The current element has: " +
this.getChildNodes().getLength() + " child nodes.";
]]>
</xsl:script>
See [6]scripting.html for more information.
3. Does XSL:P support any non-standard features?
Yes. XSL:P supports the following proprietary featues:
+ ECMAScript support for extensibility.
See [7]scripting.html for more information.
+ xsl:entity-ref
This allows the creation of an unvalidated entity in the
result tree.
Syntax: <xsl:entity-ref name="entity-name"/>
+ xsl:result-dtd processing instruction
This allows the creation of the DOCTYPE when the result tree
is serialized by the default Formatter.
Syntax: <?xsl:result-dtd doctype data here?>
Example:
<?xsl:result-dtd SYSTEM file="doc.dtd"?>
produces the following:
<!DOCTYPE root-element SYSTEM file="doc.dtd">
Where root-element is automatically determined from the
result tree.
4. I am having trouble compiling XSL:P, what could be the problem?
1. Make sure you have specified all required class files in the
CLASSPATH.
o JDK 1.1.x classes.zip
o xml4j_1_1_14.jar or the DOM package you are using
o Fesi.jar
2. Make sure you are not trying to compile DOM Support classes
that you don't have libraries for.
Do one of the following:
o Look in com/kav/xml/parser and remove DOM support
classes that you don't need.
o Add the com.kav.xml.parser.* classes that are available
in the XSL:P/ class library to your classpath
o Download the libraries from the different vendors
3. If you are using a version older than 19990201 you need to do
the following:
1. Remove the files com.kav.xsl.XMLFactory.java and
com.kav.xsl.XSLElementHandler, I accidently added these
to the archives and they should not be there.
2. Add com.kav.util.Tokenizer.class to the CLASSPATH. I
left out the source code for this class and you will
need it for compiling
4. Compile all the files at once, XSL:P uses some classes that
need to be compiled at the same instance as others since the
classes call each other.
_________________________________________________________________
Keith Visco
|