Subject: Questions about Xalan From: "Peter B. West" <pbwest@xxxxxxxxxxxx> Date: Fri, 09 Jun 2000 12:37:32 +1000 |
Dear list, I have some queries about XSLT, specifically as processed in Xalan. I am, as you will gather, new to this, and I am finding it a wee bit difficult. 1) I have found that including a default namespace declaration in the DTD of an xml file results in nothing being recognized. If I remove the declaration from the DTD, but leave it in the xml, processing proceeds smoothly. In the FAQ, there is a comment about the equivalence of default and prefixed namespaces (where the definition is identical), and that seems to imply that I should define a prefixed namespace in the xsl, which will then match on the defaulted Qnames (is that right?) in the xml and DTD. I haven't tried this. Is it corect, and if so, why does the default not work? 2) I am processing two xml documents in a single .xsl. I access the second through a document() function. This is the first document: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE dummy SYSTEM "dummy.dtd" [ ]> <dummy> <a name="aname"> <b name="bname"> <c name="cname"> This is the c text </c> </b> </a> </dummy> This is the second, called x.xml <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE dummy SYSTEM "dummy.dtd" [ ]> <dummy> <x name="xname"> <y name="yname"> <z name="zname"> This is the z text </z> </y> </x> </dummy> In the xsl file, I set up a variable with the document call like so: <xsl:variable name="xdoc" select= "document('x.xml#xpointer(id($zname))')"/> I invoke this with: <xsl:apply-templates select="$xdoc" mode="xmode"/> The zname variable has been set up like so: <xsl:variable name="zname">zname</xsl:variable> (a) Leaving aside the fact that Xalan does not seem to process XPointer fragments successfully, this combination works when the time comes to access x.xml. However, if I define the zname variable like this: <xsl:variable name="zname" select= "zname"/> (b) it doesn't work. On the other hand, if I define it like this: <xsl:variable name="zname" select= "string('zname')"/> (c) it works again. Does the select with a Qname immediately try to find and return a node-set, whereas the string function forces the type of the select? Is the result tree fragment of method (a) automatically interpreted as a string? If I define the xdoc variable using a result tree fragment, as in: <xsl:variable name = "xdoc">document('x.xml#xpointer(id("zname"))')</xsl:variable> then when I invoke as above, it fails. If I set some debugging, I get: XPATH: Can not convert #UNKNOWN to a NodeList! Can anyone clarify these things for me? Yours faithfully, Peter -- __ /__ Peter B. West pbwest@xxxxxxxxxxxx / http://www.powerup.com.au/~pbwest / "Lord, to whom shall we go?" XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: attribute value escaping, Mike Brown | Thread | RE: multilanguage support easily or, Michael Beddow |
Re: attribute value escaping (was R, Mike Brown | Date | Re: documentation, Nikolai Grigoriev |
Month |