Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2007, 01:52 AM
Authorized User
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default regarding xml in xslt

hi all
iam new to this forum and new to XSLT.
i read the tutorials yesterday.
i have an xml somethig lie this

<root>
<record value="26-06-2007">
<sree value="10:12:36">sadasdsa</sree>
<sree value="10:13:36">sadasdsa</sree>
<sree value="10:14:36">sadasdsa</sree>
<vas value="10:15:34">asdsad</vas>
<vas value="10:15:34">asdsad</vas>
<sree value="10:13:36">sadasdsa</sree>
<vas value="10:15:34">asdsad</vas>
</record>
</root>

i want change show this data in web browser so i selected XSLT
i want to show this data in following format.

Dt:26-06-2007
sree 10:12:36
sadasdsa
sree 10:13:36
sadasdsa
sree 10:14:36
sadasdsa
vas 10:15:34
asdsad
vas 10:15:34
asdsad
sree 10:14:36
sadasdsa
vas 10:15:34
asdsad
so can u show me the way .
thank u
abhi

 
Old June 26th, 2007, 02:32 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Something like this:

<xsl:template match="record>
<table>
  <xsl:for-each select="*">
    <tr>
      <td><xsl:value-of select="name()"/></td>
      <td><xsl:value-of select="@value"/></td>
    </tr>
    <tr>
      <td><xsl:value-of select="."/></td>
      <td></td>
    </tr>
  </xsl:for-each>
</table>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 26th, 2007, 03:14 AM
Authorized User
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank u
iam getting like this
sree10:12:36sadasdsasree10:13:36sadasdsasree10:14: 36sadasdsavas10:15:34asdsadvas10:15:34asdsadsree10 :13:36sadasdsavas10:15:34asdsad
coming side by side
but i need in the follwing format.
sorry for disturbing


Dt:26-06-2007
sree 10:12:36
sadasdsa
sree 10:13:36
sadasdsa
sree 10:14:36
sadasdsa
vas 10:15:34
asdsad
vas 10:15:34
asdsad
sree 10:14:36
sadasdsa
vas 10:15:34
asdsad

thank u
abhi
 
Old June 26th, 2007, 03:32 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't tell you what you are doing wrong if you don't tell me what you are doing.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 26th, 2007, 03:43 AM
Authorized User
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok sorry
i will show u my real file and i will tell u in wht format iam expecting
this my xml file
<Chat>
<DT value="26/07/2007">
<you Time="10:30:12">hi</you>
<you Time="10:31:12">hru</you>
<sree Time="10:35:16">fine</fine>
<you Time="10:32:12">hi</you>
</DT>
<DT value="27/07/2007">
<you Time="10:30:12">hi</you>
<you Time="10:31:12">hru</you>
<sree Time="10:35:16">fine</fine>
<you Time="10:32:12">hi</you>
</DT>
</chat>
now wht i required issss
HEADING:CHAT WITH SREE
DT:26/06/2007
you 10:30:12(bg color blue)
hi
you 10:31:12(bg color blue)
hru
sree 10:35:16(bg color blue)
fine
you 10:32:12(bg color blue)
hi
DT:27/06/2007
you 10:30:12(bg color blue)
hi
you 10:31:12(bg color blue)
hru
sree 10:35:16(bg color blue)
fine
you 10:32:12(bg color blue)
hi
this is wht iam trying to do
thank u for u r responce

 
Old June 26th, 2007, 04:33 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't tell you what's wrong with your XSLT code unless you show me your XSLT code.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 26th, 2007, 04:44 AM
Authorized User
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank u for ur response
and also sorry for disturbing u
this is my XSLT 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="Dt">
<table>
  <xsl:for-each select="*">
    <tr>
      <td><xsl:value-of select="name()"/></td>
      <td><xsl:value-of select="@Time"/></td>
    </tr>
    <tr>
      <td><xsl:value-of select="."/><br/></td>
      <td></td>
    </tr>
  </xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
thank u

 
Old June 26th, 2007, 04:48 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your element appears to be called DT rather than Dt. XML names are case-sensitive.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 26th, 2007, 05:00 AM
Authorized User
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yah i changed.
but still same output
thank u for ur help






Similar Threads
Thread Thread Starter Forum Replies Last Post
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM
XSLT read through XML to transform another XML dendenx2 XSLT 8 July 7th, 2005 08:18 PM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 04:26 PM
merge two xml file and make new xml using xslt ketan XSLT 0 September 21st, 2004 08:48 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.