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

Re: difficulties with exclude-result-prefixes and xsl:

Subject: Re: difficulties with exclude-result-prefixes and xsl:copy
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Wed, 08 Aug 2001 22:30:04 GMT
xsl template exclude
Amy,

>
>My XSL now looks like:
>
><xsl:template match="* | text() | @*">
>  <xsl:copy>
>    <xsl:apply-templates select="* | text() | @*"/>
>  </xsl:copy>
></xsl:template>
><xsl:template match="/xql:result">
>  <xsl:apply-templates select="*" />
></xsl:template>
><xsl:template match="/Aps:ProductStructure/@ino:id" />

This looks for an Aps:ProductStructure which is a child of the root
node.  There is no such node.  Make it either
   <xsl:template match="Aps:ProductStructure/@ino:id" />
or
   <xsl:template match="/xql:result/Aps:ProductStructure/@ino:id" />

or of course what I originally suggested.

And I think I have just realized what you meant by 'getting rid of the
prefixes'.  If you are trying to get rid of the namespace declarations
for ino and xql from the output, then you need to change the way you
copy elements.  Replace the first template with:

<xsl:template match="@*">
  <xsl:copy />
</xsl:template>

<xsl:template match="*">
  <xsl:element name="{name()}" >
    <xsl:apply-templates select="* | text() | @*"/>
  </xsl:element>
</xsl:template>

(tested with Saxon 6.2.2)

Your problem was that when xsl:copy copies an element it copies all
its namespace nodes too.  Using xsl:element instead prevents this.
Notice that XSLT is clever enough to insert the declaration for Aps
because it sees you have used it in the name of an element.

>
>and I'm still getting the same XML results.  What am I doing wrong?
>
>Amy
>
Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.