Jump to content

xslt 1 transformation help


sbutt
 Share

Recommended Posts

Hi all, I am kind of stuck in implementing a rather tricky output for my given xml source. My input is:

<PickUpOpeningHours>08:00 - 22:00</PickUpOpeningHours>

And I want an output similar to:

 <SubSection SubTitle="OfficeHours"><Paragraph Name="Monday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Tuesday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Wednesday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Thursday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Friday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Saturday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph><Paragraph Name="Sunday"><Text>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCCCC</Text></Paragraph></SubSection> 

Let me explain the output logic. C: closesO: opened Time is represented in 24 hours. 1 hour = 4 x 15 min (4 quarters)24 hours = 96 x 15 min (96 quarters) Total characters (C or O) will be 96 in total, where each character represents single quarter of time. The input xml could be of two different formats:

<PickUpOpeningHours>07:00 - 23:00</PickUpOpeningHours>

OR

<PickUpOpeningHours>08:30 - 12:00, 14:30 - 18:00</PickUpOpeningHours>

Can someone please help me out in devising some solution for the above problem using xslt 1? Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...