|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
What if current or . doesn' return a value?
I am using
<xsl:value-of select="local-name(current())" />But it returns nothing... |
|
#2
|
|||
|
|||
|
Explain the problem a bit more, and post some more code, it will be easier to provide you with a useful answer
![]() Rgds |
|
#3
|
|||
|
|||
|
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... |
|
#4
|
|||
|
|||
|
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 ![]() |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
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? |
|
#8
|
|||
|
|||
|
reply into your other post
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > What if current or . doesn' return a value? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|