[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] FIXED: [docbook-apps] Processing Xincludes using document() and xml:id (docbook 5)
Hi, id() is an XSLT function (see your local XSLT reference), while xml:id() is not. It has nothing to do with the name of the attribute, only the type of the attribute (defined in the schema as attribute type ID). In fact, the id() function works fine with xml:id attributes since they are defined as type ID. Bob Stayton Sagehill Enterprises bobs@sagehill.net ----- Original Message ----- From: "Jeff Hooker" <Jeff_Hooker@pmc-sierra.com> To: <docbook-apps@lists.oasis-open.org> Sent: Thursday, October 09, 2008 2:55 PM Subject: [docbook-apps] FIXED: [docbook-apps] Processing Xincludes using document() and xml:id (docbook 5) > Hi all, > > Fixed the problem by changing the: > > <xsl:copy-of select="xml:id($id_value2)"/> > > to: > > <xsl:copy-of select="//*[@xml:id=$id_value2]"/> > > Still, if anyone could explain to me why: > > <xsl:copy-of select="id($id_value2)"/> > > worked fine but: > > <xsl:copy-of select="xml:id($id_value2)"/> > > failed, I'd be most interested. > > Cheers, > Jeff. > > -----Original Message----- > From: Jeff Hooker [mailto:Jeff_Hooker@pmc-sierra.com] > Sent: Thursday, October 09, 2008 1:56 PM > To: docbook-apps@lists.oasis-open.org > Subject: [docbook-apps] Processing Xincludes using document() and xml:id > (docbook 5) > > > Hi all, > > My employer is rolling out an XML CMS that has issues resolving xincludes. > The workaround that I need to perform is writing a short XSL to preprocess > my files and resolve Xincludes manually. > > My script worked fine on a couple of test docbook 4 test files that used > the id attribute to identify nodes, but as soon as I switched to my > docbook 5 files and changed the referenced attribute to xml:id, I began > getting the following: error message: > > "The URI http://www.w3.org/XML/1998/namespace does not identify an > external Java class" > > Now, the namespace quoted, is of course, the default XML namespace. During > the process of flailing about, I did try explicitly binding xml to its > namespace (xmlns:xml='http://www.w3.org/XML/1998/namespace') but had no > effect. > > The script as it stands looks like this: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:exsl="http://exslt.org/common" > xmlns:fo="http://www.w3.org/1999/XSL/Format" > xmlns:ng="http://docbook.org/docbook-ng" > xmlns:db="http://docbook.org/ns/docbook" > xmlns:xi="http://www.w3.org/2001/XInclude" exclude-result-prefixes="db > ng exsl" version="1.0"> > > <xsl:template match="/"> > <xsl:apply-templates/> > </xsl:template> > > <xsl:template match="@*|node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > > <xsl:template match="xi:include"> > <!-- grab the value contained in the bracket of the xpointer > attribute --> > <xsl:variable name="id_value1"> > <xsl:value-of select="substring-before(@xpointer, ')')"/> > </xsl:variable> > <xsl:variable name="id_value2"> > <xsl:value-of select="substring-after($id_value1, '(')"/> > </xsl:variable> > <xsl:for-each select="document(@href,/)"> > <xsl:copy-of select="xml:id($id_value2)"/> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > Thanks in advance for any help. > Jeff. >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]