[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

troubles with document()

Subject: troubles with document()
From: Alexey Nickolaenkov <nikolaenkov@xxxxxxxxxxxx>
Date: Thu, 25 Jan 2007 22:39:19 +0300
 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.