This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: cutting it short!


could you do something like the following?

<xsl:if test="self::node()[name()='eventName' or name()='applicationName'">
</xsl:if>

Regards

Amir

> -----Original Message-----
> From:	owner-xsl-list@lists.mulberrytech.com
> [SMTP:owner-xsl-list@lists.mulberrytech.com]
> Sent:	Wednesday, July 11, 2001 11:50 PM
> To:	xsl-list
> Subject:	[xsl] cutting it short!
> 
> Reply-To: <skohli@mobilehelix.com>
> From: "sumev" <skohli@mobilehelix.com>
> To: <XSL-List@lists.mulberrytech.com>
> Subject: Help for cutting it short!
> Date: Wed, 3 Jan 2001 17:58:07 -0500
> Message-ID: <GAEMJDODNEBPDDAADPLPAEPPCBAA.skohli@mobilehelix.com>
> 
> 
> Hi Folks!,
>         I am workin on simple xslt and want to make it look good (I want
> to
> make it short! lot of xsl:when statements)
> 
> xsl -->
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
>   <xsl:output method="xml"/>
> 	<xsl:template match="request">
> 		<xsl:copy>
> 		<xsl:attribute name="id">
> 			<xsl:value-of select="id"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="eventName">
> 			<xsl:value-of select="eventName"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="applicationName">
> 			<xsl:value-of select="applicationName"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="originator">
> 			<xsl:value-of select="originator"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="variable">
> 			<xsl:value-of select="variable"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="timestamp">
> 			<xsl:value-of select="timestamp"/>
> 		</xsl:attribute>
> 		<xsl:attribute name="typeid">
> 			<xsl:value-of select="typeid"/>
> 		</xsl:attribute>
> 			 <xsl:for-each select="@*|*[not(* or @*)]">
> 			    <xsl:choose>
> 				 <xsl:when test="name()='id'"/>
> 			         <xsl:when test="name()='eventName'"/>
> 			         <xsl:when test="name()='applicationName'"/>
> 			         <xsl:when test="name()='originator'"/>
> 			         <xsl:when test="name()='variable'"/>
> 			         <xsl:when test="name()='timestamp'"/>
> 			         <xsl:when test="name()='typeid'"/>
> 				 <xsl:otherwise>
> 				<xsl:element name="dataset">
> 						<xsl:element name="tag">
> 							<xsl:value-of
> select="name()"/>
> 						</xsl:element>
> 						<xsl:element name="value">
> 							<xsl:value-of
> select="."/>
> 						</xsl:element>
> 				</xsl:element>
> 			     </xsl:otherwise>
> 			  </xsl:choose>
> 			</xsl:for-each>
> 			<xsl:apply-templates select="*[* or @*]|text()"/>
> 		</xsl:copy>
> 	</xsl:template>
> </xsl:stylesheet>
> 
> example
> xml file ->
> 
> <?xml version="1.0"?>
> <request>
> 	<id> 1 </id>
> 	<eventName> hi </eventName>
> 	<applicationName> demo </applicationName>
> 	<originator> new </originator>
> 	<variable> a </variable>
> 	<timestamp> 1/1/1 </timestamp>
> 	<typeid> 234 </typeid>
> 	<user> user1 </user>
> 	<passwd> sk </passwd>
> </request>
> 
> Thanks
> Sumev
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]