[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] troubles with document()
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|