[xslt] document() Function and Fragment Identifiers



Hello,

I'm working on an xsl implementation that requires retrieving documents over 
the network using fragment identifiers.  By fragment identifiers I mean URLs 
that look like: 

http://www.truenorth.nu/goodstuff.xml#moregood

In this example everything after the "#" is the identifier for a node (e.g. an 
attribute where id="moregood").  From reading the documentation for libxslt 
and xsl (Tidwell's book) my understanding is that this should return the node 
with the "moregood" id and any children the node might have.

Is this an accurate understanding of how this should work?

If my understanding of how fragment identifiers should work is accurate, the 
following example is returning a null or empty set for a URL when using a 
fragment ID when I would expect to get a node set based on the id: 


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> 
  <xsl:output method="text" omit-xml-declaration="yes" indent="yes" />
        <xsl:variable name="mainTree" 
select="document('http://taxonomies.xbrl.us/us-gaap/2009/elts/us-
gaap-2009-01-31.xsd#us-
gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent')" />
<!--  
<xsl:variable name="mainTree" select="document('http://taxonomies.xbrl.us/us-
gaap/2009/elts/us-gaap-2009-01-31.xsd')" />
        --> 

        <xsl:template match="/">
                <xsl:if test="not($mainTree)">
                                Maintree is empty
                </xsl:if>
    <xsl:apply-templates />
  </xsl:template>

</xsl:stylesheet>


Being new to xslt and xsltproc I may have misunderstood how this should work, 
but after examining all of the documentation and several books on the subject, 
it seems like this should work.

Thanks in advance for your assistance.

Regards,

Mark Gannon






Attachment: signature.asc
Description: This is a digitally signed message part.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]