p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: Extract the Attribute name and value


Message #1 by "Vikram" <vikyjoshi@r...> on Tue, 3 Jul 2001 13:41:56
I think Michael already mentioned this, but I don't think that the "name()"
function is supported in WD-xsl.  

I will reiterate what Michael has said so many times:  WD-xsl and XSLT are
quite different.  Trying to get accurate answers about WD-xsl questions in
an XSLT discussion group is like trying to get good information about Java
from a JavaScript group: you can't.

-----Original Message-----
From: Nanda Kumar (RBIN/DBA-MST) [mailto:Nanda.Kumar@i...]
Sent: Wednesday, July 04, 2001 5:35 AM
To: P2P_XSLT
Subject: [xslt] RE: Extract the Attribute name and value


hi vikram,

	i am getting "Unspecified error" for the example sent by you. 
Help is needed to rectify this error.

my xml file is :
<?xml version="1.0" ?> 
<?xml-stylesheet type="text/xsl" href="getdata.xsl" ?>
<xml xmlns:icws='http://ispan-tech.com/webservice'>
<icws:Book fieldName="bookreview" fieldAlias="Book Review" 
exParam="default" />
<icws:Book fieldName="bookreview" fieldAlias="Book Review" 
exParam="default" />
<icws:Book fieldName="bookreview" fieldAlias="Book Review" 
exParam="default" />
<icws:Book fieldName="bookreview" fieldAlias="Book Review" 
exParam="default" />
<icws:Book fieldName="bookreview" fieldAlias="Book Review" 
exParam="default" />
</xml>
 
its corresponding xsl is :
<?xml version="1.0" ?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
 <xsl:template match="/">
	<xsl:for-each select="//@*">
	<xsl:value-of select="name()"/> = <xsl:value-of select="."/>;
	</xsl:for-each>
 </xsl:template>
 </xsl:stylesheet>

Nandu 
Bosch
> -----Original Message-----
> From:	Vikram [SMTP:vikyjoshi@r...]
> Sent:	Wednesday, July 04, 2001 4:16 PM
> To:	P2P_XSLT
> Subject:	[xslt] RE: Extract the Attribute name and value
> 
> > I have not tried Michael's example yet, but I know where the xml tag 
> came 
> > from, at least when using ASP. You get that tag when pulling from the 
> > Stream's string for XML output. I forget the author, but in Wrox's 
> > Professional ASP book it does say to replace the xml tag in the string 
> > with something else if you want to use a data island, and probably if 
> you 
> > want to extract for XSLT (at least from what Michael is saying.
> > 
> > Even then, I still ran into the same problem you have for extracting the
> 
> > attributes. Hope his example works...
> > 
> 
> i tried micheal eg but i could not get the result. Also there is problem 
> about the xml namespaces if i use name space 
> --->  <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> 
> 
> i get following error
> --->  Unknown method. -->name()<--
> 
> 
> and if i use this name space 
> --->  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0">
> i get nothing but "=;" on browser.
> i don know whats wrong in my code
> 
> my xml file is :
> <?xml version="1.0" ?> 
> <?xml-stylesheet type="text/xsl" href="getdata.xsl" ?>
> <xml xmlns:icws='http://ispan-tech.com/webservice'>
> <icws:Book fieldName="bookreview" fieldAlias="Book Review" 
> exParam="default" />
> <icws:Book fieldName="bookreview" fieldAlias="Book Review" 
> exParam="default" />
> <icws:Book fieldName="bookreview" fieldAlias="Book Review" 
> exParam="default" />
> <icws:Book fieldName="bookreview" fieldAlias="Book Review" 
> exParam="default" />
> <icws:Book fieldName="bookreview" fieldAlias="Book Review" 
> exParam="default" />
> </xml>
>  
> its corresponding xsl is :
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
>  <xsl:template match="/">
> 	<xsl:for-each select="//@*">
> 	<xsl:value-of select="name()"/> = <xsl:value-of select="."/>;
> 	</xsl:for-each>
>  </xsl:template>
>  </xsl:stylesheet>
>


  Return to Index