[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] troubles with document()
Subject: [xsl] troubles with document() From: Alexey Nickolaenkov <nikolaenkov@xxxxxxxxxxxx> Date: Thu, 25 Jan 2007 22:39:19 +0300 |
Thank you Andrew with numerating in the doc-flow. I've studied xsl:number deeply and this is the best way to do so. But I've got another problem. It's hard to describe, but I'll do my best. Imagine that somewhere in code you want to access another xml document. document() function works great, but here is thing I can't understand by myself. I have the following variable <xsl:variable name="gallery-xml" select="document('../images_gallery.xml.html', /)"> and I'm trying to load the following xml document <?xml version="1.0" encoding="UTF-8"?> <aa> <bb>test</bb> </aa> But here saxon comes up with the following warning: [FATAL] {xmlcopy} Error reported by XML parser; SystemID: file:/C:/test/images_gallery.xml.html; Line#: 1; Column#: -1 [ERROR] {xmlcopy} org.xml.sax.SAXParseException: Document root element is missing.; SystemID: file:/C:/gallery.xslt; Line#: 13; Column#: -1 This path "file:/C:/test/images_gallery.xml.html" is good, but when I try to count($gallery-xml//node()) it returns 0. Any ideas? my xslt: <?xml version='1.0' encoding='us-ascii'?> <xsl:stylesheet version="2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="#all"> <xsl:variable name="gallery-xml" select="document('../images_gallery.xml.html', /)"/> <xsl:template match="/" mode="gallery"> <xsl:message> <xsl:value-of select="count($gallery-xml//node())"/> </xsl:message> <xsl:copy> <xsl:apply-templates select="node()" mode="gallery"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()" mode="gallery"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="gallery"/> </xsl:copy> </xsl:template> </xsl:stylesheet> my xml: <?xml version="1.0" encoding="UTF-8"?> <aa> <bb>test</bb> </aa> -- Alexey mailto:nikolaenkov@xxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Error -- Could not find f, Abel Braaksma | Thread | Re: [xsl] troubles with document(), David Carlisle |
Re: [xsl] testing for position of a, ms | Date | Re: [xsl] Input requested for a goo, Dimitre Novatchev |
Month |
Keywords