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 February 26th, 2004, 12:51 PM
Sarnix Sarnix is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Rotterdam
Posts: 76 Sarnix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 13 m 43 sec
Reputation Power: 6
xsl: it prints without any command

Hi,

i am pretty new to xsl and i ran into this weird problem.
To me it's so weird it's even hard to describe.
The xsl file prints the value of the following 2 xml nodes without any command.
<superuser>TRUE</superuser>
<admin>TRUE</admin>
The page prints TRUETRUE and then follows the rest of the html and i havent got a clue why it prints those 2 values.
This is xml and this is the xsl

Thanks,

Sarnix

Reply With Quote
  #2  
Old February 26th, 2004, 01:51 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
I don't really have an explanation why, but this is what you need to do:

add the following template:
Code:
<xsl:template match="/">
	<xsl:apply-templates select="document/ftpuser"/>
</xsl:template>


and change the other template:
Code:
<xsl:template match="ftpuser">
     ....
</xsl:template>

Last edited by MattSidesinger : February 26th, 2004 at 01:53 PM.

Reply With Quote
  #3  
Old February 26th, 2004, 01:53 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
I think that if you don't match the XML document root (different than your document element) then the XSL uses a default template that matches textual element data and prints it out.

I will look at the spec and try to see if this is accurate.

Reply With Quote
  #4  
Old February 26th, 2004, 05:43 PM
wbhambone wbhambone is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 wbhambone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
while i agree that it's a good idea to start with a match of root (it just gives you more control) i'm pretty sure that xsl is not using a "default" template that will print the text of nodes out.

there has to be another, valid, reason as to why this is happening.

Reply With Quote
  #5  
Old February 26th, 2004, 10:08 PM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 259 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 16 m 51 sec
Reputation Power: 6
Here are the builtin (default) template rules for XSLT1. See section 5.8 of the specification for full details.

<xsl:template match="*|/">
<xsl:apply-templates>
</xsl:template>

<xsl:template match="@*|text()">
<xsl:value-of select=".">
</xsl:template>

<xsl:template match="comment()|processing-instruction()"/>

Note the builtin template rule for copying text and attribute nodes.

Reply With Quote
  #6  
Old February 27th, 2004, 07:52 AM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
Booyah! Thanks fpmurphy for the post ... I will now have babies with you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xsl: it prints without any command


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 4 hosted by Hostway