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 June 7th, 2004, 04:13 AM
frankito frankito is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 frankito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It doesn't get any simpler than this.

I'm really struggling with XSL, so I've gone back to trying to understand the very basics. I have an XML file in it with names, address, etc, and when I do the following, in addition to "telephone" coming back with the bracketed elements, which I want, ALL the other content of the source XML file is coming back as text. Why? Aren't I just asking it to match "telephone"?

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslutput method="xml" indent="yes" />

<xsl:template match="telephone">
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

Reply With Quote
  #2  
Old June 7th, 2004, 05:02 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
template calling

templates
===============
1.
if u use "match" template <xsl:template match="telephone">

u have to use apply template
<xsl:apply-templates select="//telephone"/>- to apply the template
as shown below in the example

(or)

2. if u use - <xsl:template name="telephone">
u have to use <xsl:call-template name="telephone"/>
====================


<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslutput method="xml" indent="yes" />


<xsl:template match="/">
<xsl:apply-templates select="//telephone"/>
</xsl:template>

<xsl:template match="//telephone">
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>
===========
hope fully this is what u required..however if u give xml .. also it can be explained easily...
thank u
with regards
niha

Reply With Quote
  #3  
Old June 7th, 2004, 05:05 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
frank - provide ur xml also

hi frank
provide ur xml also ..so that i can try to figure it out.
bcoz it is bit unclear to give correct solution
thank u
niha

Reply With Quote
  #4  
Old June 7th, 2004, 05:15 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
templates

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" indent="yes" encoding="UTF-8" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>


<xsl:template match="/">
<xsl:apply-templates select="//telephone"/>
</xsl:template>


<xsl:template match="telephone">
<xsl:value-of select="."/>
<br/>
</xsl:template>

</xsl:stylesheet>
============================


hope the above code helps u
as far as i know... even u match the template... u have to apply the template with relevant tag - as shown above
hope that is what u r looking for
with regards
niha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > It doesn't get any simpler than this.


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 5 hosted by Hostway
Stay green...Green IT