XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Michael KweeSubject: How to loop trough and identify attributes within a node
Author: Michael Kwee
Date: 10 Jan 2007 05:05 PM
Originally Posted: 10 Jan 2007 05:03 PM
Hi there,

I have a problem with identifying specific attributes within a node starting with "Date_".

The objective of the XSLT is to identify and transform those attributes that starts with "Date_" into other date format. However when i loop through the XML, the node that contains a few attributes cannot be identified using name() or "@*".

Is there a way to identify the attributes using wildcard function like start-with and so on ?

Please find attached my XSLT and the source XML. I have hardcoded the attributes within the SiebelMessage in this XSLT and it can work in this way.

Thanks.


Unknowndate_conversion.xslt


UnknownBeforeTransformOutboundSBLXml_2E-20A-Req.xml

Posttop
(Deleted User) Subject: How to loop trough and identify attributes within a node
Author: (Deleted User)
Date: 11 Jan 2007 04:11 AM
Hi Michael,
I guess you are referring to the part of the stylesheet that copies the attributes unchanged; a possible solution could be this:

<xsl:when test="starts-with(name(),'SiebelMessage')">
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="starts-with(name(),'Time')">
<xsl:attribute name="{name()}">
<xsl:call-template name="Ext:transform_datetime">
<xsl:with-param name="Node"><xsl:value-of select="."/></xsl:with-param>
<xsl:with-param name="Interface_Direction" select="$Interface_Direction"></xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:copy/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates select="*|text()"/>
</xsl:when>

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.