[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] remove shape="rect" attribute from anchors within xsl:template


Subject: [xsl] remove shape="rect" attribute from anchors within xsl:template
From: "B. Kamer" <post@xxxxxxxxxxx>
Date: Fri, 2 Nov 2007 14:02:11 +0100

hi all,

i am totally new to xslt so forgive my for asking stupid things.

let me explain my goals:

- i have several xhtml documents
- these documents are listed in an xml document
- the xsl template reads the xml and 'imports' the xhtml files (with <xsl:copy-of select="document($full-path)/html:html/html:body/*" namespace="http://www.w3.org/1999/xhtml"/>) to generate a new xhtml document.


Basicly it merges xhtml documents & adds a table of contents based on anchors in the documents... (i didn't write that myself)

this works, more or less, but several things are added into the output...

but <a> tags in the imported documents are getting an shape="rect" attribute that i don't like...

i found this document to remove those by setting a template for them

<xsl:template match="xhtml:a/@shape"/>

see: http://xmlplease.com/shaperect

but as my imported documents are not part of the xml file this does not work...

here is the template responsible of merging the documents

    <xsl:template name="merge-documents">
        <xsl:param name="chapter-list" />

        <xsl:variable name="result">
            <xsl:for-each select="$chapter-list">
                <xsl:variable name="full-path">
                    <xsl:value-of select="$base-path" />
                    <xsl:text>/</xsl:text>
                    <xsl:value-of select="@path" />
                </xsl:variable>

<xsl:copy-of select="document($full-path)/html:html/ html:body/*" namespace="http://www.w3.org/1999/xhtml"/>
</xsl:for-each>
</xsl:variable>


<!-- Return merged document -->
<xsl:copy-of select="$result" namespace="http://www.w3.org/1999/xhtml " />
</xsl:template>



Now, my question, how do i remove the unwanted attributes from any anchor tag in the $result variable?



thank you



Current Thread
Keywords