text()" vs. "node()"

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

Re: "*|@*|text()" vs. "node()"

Subject: Re: "*|@*|text()" vs. "node()"
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 04 Oct 2001 16:00:51 +0200
Re:  "*|@*|text()" vs. "node()"
The stylesheet should copy all nodes from the input to the output. Only a few should be changed, @href is one example for this.

The original stylesheet as you can see it below works correctly!!

As far as I know <xsl:apply-templates/> is the same like <xsl:apply-templates select="*|text()"/>, the attributes are missing. So I need my extended version. <xsl:apply-templates select="*|@*|text()"/> matches all child-elements (not the descendants!), all attributes and all text-nodes.

<xsl:choose> as child of <xsl:attribute> is possible. It worked already. Furthermore you can look at http://www.topxml.com/xsl/elmxsl_attribute.asp or http://www.w3.org/TR/xslt#dtd.

The opening element for <xsl:attribute> is in the template matching "*|@*|text()", only the attribute href should be created in the result-tree with a new value. <xsl:attribute> is also allowed as child of <xsl:template>.

match="*/@href" makes of course no difference, because an attribute must always have an element as parent.

Thanks for your reply, but it doesn't help.

Joerg


Corey Spitzer wrote:


instead of <xsl:apply-templates select="*|@*|text()"/>, I think you just
want <xsl:apply-templates> otherwise, you're applying the templates to the
children of whatever matches the template first and not getting the original
match.  Also, I think that it's going to match everything so all the
children 3 levels nested and below are going to be repeated.  As far as the
attribute, I don't believe you can have <xsl:choose> as a child of
<xsl:attribute>.  Also, you can't have <xsl:attribute> without an opening
element before it..  Also, I don't know if it would make a difference, but
try <xsl:template match="*/@href"> instead of simply match="href"


-----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jörg Heinicke Sent: Thursday, October 04, 2001 7:49 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: "*|@*|text()" vs. "node()"


I want to shorten/improve my XSL-code, but a problem occures. Until now I had a stylesheet like the following:

<xsl:template match="*|@*|text()">
   <xsl:copy>
     <xsl:apply-templates select="*|@*|text()"/>
   </xsl:copy>
</xsl:template>

<xsl:template match="@href">
   <xsl:attribute name="href">
     <xsl:choose>
       <!-- specifying the value -->
     </xsl:choose>
   </xsl:attribute>
</xsl.template>

<!-- some more templates -->

Now I changed "*|@*|text()" to "node()" (both <xsl:template> and
<xsl:apply-templates>) and I thought it should make no differences, because
the original XML contains only elements, attributes and text-nodes.
But now I get an error-message:

href has an illegal attribute: {1}

Is this a bug in Xalan, because the priority of the templates doesn't work
correctly anymore? Or what can be the problem?

Thanks in advance,

Joerg

--

System Development
VIRBUS AG
Fon +49(0)341-979-7435
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


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



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






--

System Development
VIRBUS AG
Fon +49(0)341-979-7435
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


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.