Antonio,
At 11:58 AM 4/13/2006, you wrote:
Hi all:
I'm trying to navigate thru the attributes of a element, but no
success. Something like
<xsl:template match="@*">
<xsl:if test="following-sibling::attribute()">
</xsl:if>
</xsl:template>
meaning if there is more attributes for this node...
Right. This won't work since attributes don't have siblings. They
have parents, but since they aren't children of their parents, they
aren't siblings of the other attributes.
But ofcourse that wont work...
I finnaly made what i want using
<xsl:when test="position()=last()">
This works because when attributes are selected they are assigned a
context position, so there will be a last one -- but which one it is,
is up to the processor, since attributes are not ordered in the data model.
But what if i need to use axis with attributes? Or there arent't axis
with attributes? If so, how can i refrence other attributes on the
same element?
This is one place where XSLT 1.0 gets dicey. You can say ../@* to get
all the attributes on an element, starting from one of them. To get
all the *other* attributes, however, you more or less have to use an
explicit name test, as in "../@*[not(name()=name(current())]", which
is admittedly fairly ugly.
In XPath 2.0 you can say ../@*[not(. is current())] which is a bit
better, if not much.
To say more, we'd have to know more about why you're asking.
In general, these limits reflect the "second-class" status of
attributes in the XML/XSLT paradigm. Assuming your XML is
well-designed, this is mostly a good thing (attributes are easily
hidden or ignored, etc.): when something is "first-class" it should
be an element. I do understand that much XSLT is written to
ameliorate badly-designed XML.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--