INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

XML XSL formatting

XML XSL formatting

(OP)
Hi guys,

I have an XML code below

the XML code

CODE

.
.
.
<s:timesSessionType sessionType="surgery">
- <s:daysOfWeek>
- <s:dayOfWeek>
  <s:dayName>Sunday</s:dayName> 
- <s:timesSessions>
  <s:timesSession>Closed</s:timesSession> 
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Monday</s:dayName> 
- <s:timesSessions>
- <s:timesSession>
  <s:fromTime>08:00</s:fromTime> 
  <s:toTime>20:30</s:toTime> 
  </s:timesSession>
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Tuesday</s:dayName> 
- <s:timesSessions>
- <s:timesSession>
  <s:fromTime>08:00</s:fromTime> 
  <s:toTime>18:30</s:toTime> 
  </s:timesSession>
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Wednesday</s:dayName> 
- <s:timesSessions>
- <s:timesSession>
  <s:fromTime>08:00</s:fromTime> 
  <s:toTime>20:30</s:toTime> 
  </s:timesSession>
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Thursday</s:dayName> 
- <s:timesSessions>
- <s:timesSession>
  <s:fromTime>08:00</s:fromTime> 
  <s:toTime>18:30</s:toTime> 
  </s:timesSession>
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Friday</s:dayName> 
- <s:timesSessions>
- <s:timesSession>
  <s:fromTime>08:00</s:fromTime> 
  <s:toTime>18:30</s:toTime> 
  </s:timesSession>
  </s:timesSessions>
  </s:dayOfWeek>
- <s:dayOfWeek>
  <s:dayName>Saturday</s:dayName> 
- <s:timesSessions>
  <s:timesSession>Closed</s:timesSession> 
  </s:timesSessions>
  </s:dayOfWeek>
  </s:daysOfWeek>
  </s:timesSessionType>
.
.
. 

how do I format it from

CODE

SundayClosed
Monday08:0020:30
Tuesday08:0018:30
Wednesday08:0020:30
Thursday08:0018:30
Friday08:0018:30
SaturdayClosed 

to this? Thanks for any inputs.

CODE

Sunday: Closed
Monday: 08:00-20:30
Tuesday: 08:00-18:30
Wednesday: 08:00-20:30
Thursday: 08:00-18:30
Friday: 08:00-18:30
Saturday: Closed 

my XSL is like this:

CODE

<xsl:for-each select="./a:content/s:overview/s:openingTimes/s:timesSessionTypes/s:timesSessionType[@sessionType='surgery']/s:daysOfWeek/s:dayOfWeek">
				<xsl:value-of select="."/><br/>
			</xsl:for-each> 

RE: XML XSL formatting

Something along these lines:

CODE --> XSLT

<xsl:for-each ...>
<xsl:choose> <xsl:when test="normalize-space(s:timesSessions/s:timesSession/text()[1]) = 'Closed'"> <xsl:value-of select="concat(s:dayName, ': Closed')"/><br/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(s:dayName, ': ', s:timesSessions/s:timesSession/s:fromTime,' - ', s:timesSessions/s:timesSession/s:toTime)"/><br/> </xsl:otherwise> </xsl:choose>
</xsl:for-each>

Tom Morrison
Hill Country Software

RE: XML XSL formatting

(OP)
Hi K5tm,

That's AWESOME!

Thanks very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close