XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2004, 05:58 AM
Aphex3k Aphex3k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 Aphex3k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What if current or . doesn' return a value?

I am using
<xsl:value-of select="local-name(current())" />
But it returns nothing...

Reply With Quote
  #2  
Old August 9th, 2004, 06:24 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Explain the problem a bit more, and post some more code, it will be easier to provide you with a useful answer

Rgds

Reply With Quote
  #3  
Old August 9th, 2004, 08:12 AM
Aphex3k Aphex3k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 Aphex3k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I was wondering that the current() function or the . should return the name of the node that is currently processed. Shouldn't it?

if i have something like namespace-uri(.) or namespace-uri(current()) in my code i get nothing in return...

Reply With Quote
  #4  
Old August 10th, 2004, 05:32 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
To be honest, I almost never use current(), I rather use local-name().

From w3schools: The current() function returns a node-set that contains only the current node. Usually the current node and the context node are the same.

So if what you're trying to get is the name of the node being processed, say in a for-each loop, you can do this (it works, I use it ) :

Code:
<xsl:for-each select="//Nodes/*">
  <xsl:value-of select="local-name()" />
</xsl:for-each>


If you're xml tree looks like this:

<Nodes>
<MyNode1 />
<MyNode2 />
<MyNode3 />
</Nodes>

This will return the names MyNode1, MyNode2, MyNode3.

In any case, don't use local-name(current()), this is wrong.

Hope this helps

Reply With Quote
  #5  
Old August 10th, 2004, 05:50 AM
Aphex3k Aphex3k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 Aphex3k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

ok, here is what i have: (i hade to cross (xxx) some parts for publicity)
the XML
Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="schema.xsl" ?>

<schema
   xmlns="xxx"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="xxx schema.xsd"
>	
   <attributetype>
      <name>profile</name>
   </attributetype>
   <attributetype>
	  <name>number</name>
   </attributetype>
   <attributetype>
      <name>basiService</name>
   </attributetype>
   <objectclass>
      <name>Characteristics</name>
   </objectclass>
</schema>

My XSL
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>

<xsl:for-each select="//Nodes/*">
  <xsl:value-of select="local-name()" />
</xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

The output is... nothing.

Reply With Quote
  #6  
Old August 10th, 2004, 06:54 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
well, of course, just copy-pasting my code wasn't going to work

What exactly are your expecting as output from your xml ? and why do you exactly need to use local-name() or current() ?

You haven't really explained any of this since the beginning.

Reply With Quote
  #7  
Old August 10th, 2004, 07:38 AM
Aphex3k Aphex3k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 Aphex3k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Im sorry for that but thats part of another post.
Im actually trieng to integrate XSD in my XML and want to let it be processable by XSL.

Did someone manage to do that?

Reply With Quote
  #8  
Old August 11th, 2004, 12:17 PM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
reply into your other post

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > What if current or . doesn' return a value?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT