OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: 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)"/>


<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.


-----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:template match="@*|node()">
            <xsl:apply-templates select="@*|node()"/>

    <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 name="id_value2">
            <xsl:value-of select="substring-after($id_value1, '(')"/>
        <xsl:for-each select="document(@href,/)">
            <xsl:copy-of select="xml:id($id_value2)"/>

Thanks in advance for any help.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]