E-Commerce Technologies

E-Commerce Technologies

Name: Homework 2 for CSC 513: E-Commerce Technologies Collaborative Work You may form teams of 1–4 members (of students in Listing 2: XML output for Problem 1.1 this class) to cooperate on this problem set. After dis- <?xml v e r s i o n ="1.0"?> cussing the problem, please write up your answers indi- §<SongList> ¤ vidually. Indicate the names of the other members in your <Song l g =’en’> team, if any. Hotel California <Sgr name=’Eagles’ g e n re =’rock’/> 5 </Song> 1 XSLT <Song l g =’en’> Seven Bridges Road Consider the XML document in Listing 1. <Sgr name=’Eagles’ g e n re =’rock’/> </Song> 10 <Song l g =’cpe’> Listing 1: XML input Day O <?xml v e r s i o n ="1.0"?> <Sgr name=’H Belafonte’ g e n re =’reggae’/> §<!−− Sgr , lg , and ti abbreviate Singer , −−> ¤ </Song> <!−− language , and t i t l e , respectively . −−> <Song l g =’en’> 15 <!−− The standard ( ISO 6 3 9 ) codes f o r −−> Jamaica Farewell <Sgr name=’H Belafonte’ g e n re =’reggae’/> <!−− English and Punjabi are en and pa , −−> 5 <!−− respectively . −−> </Song> <Songs> <Song l g =’him’> <Sgr name=’Eagles’ g e n re =’rock’> Ajahoon Na Bhejiho 20 <Song l g =’en’ t i =’Hotel California’/> <Sgr name=’J Prasad’ g e nr e =’classical’/> </Song> <Song l g =’en’ t i =’Seven Bridges Road’/> 10 </Sgr> <Song l g =’pa’> <Sgr name=’H Belafonte’ g e n re =’reggae’> Mera Dil Darda <Song l g =’cpe’ t i =’Day O’/> <Sgr name=’J Prasad’ g e nr e =’classical’/> 25 <Song l g =’en’ t i =’Jamaica Farewell’/> </Song> <Song l g =’en’> </Sgr> 15 <Sgr name=’J Prasad’ g e n re =’classical’> Never a Result <Song l g =’him’ t i =’Ajahoon Na Bhejiho’/> <Sgr name=’J Prasad’ g e nr e =’classical’/> <Song l g =’pa’ t i =’Mera Dil Darda’/> </Song> 30 <Song l g =’en’ t i =’Never a Result’/> </ SongList> </Sgr> 20 </Songs> ¦ ¥ ¦ ¥ 1.1. (25 points) Write an XSLT stylesheet that reads in Listing 1) and produces a list of songs in which Sgr is a subelement of Song and certain attributes are con- verted to text (see Listing 2). Document your answer. Don’t over-do the use of fancy constructs. You should be able to get a lot done with just xsl:template, xsl:apply-templates, xsl:copy, xsl:value- of, and xsl:copy-of. c February 8, 2005 Munindar P. Singh Name: Homework 2 for CSC 513: E-Commerce Technologies Independent Work You must solve this problem set individually without Listing 3: XML output for Problem 3.1 any assistance from anyone. <?xml v e r s i o n ="1.0"?> §<SongList> ¤ 2 XPath <Song l g =’en’ g e nr e =’rock’> <Sgr name=’Eagles’/> Hotel California 5 2.1. (15 points) Write an XPath expression to find just </Song> the names of singers who sang at least two English <Song l g =’en’ g e nr e =’rock’> songs. <Sgr name=’Eagles’/> Seven Bridges Road 2.2. (15 points) Without using count, write an XPath ex- </Song> 10 pression to find just the names of singers who sang at <Song l g =’cpe’ g e n re =’reggae’>Day O <Sgr name=’H Belafonte’/> least one Punjabi song. </Song> <Song l g =’en’ g e nr e =’reggae’> <Sgr name=’H Belafonte’/> 15 3 XSLT Jamaica Farewell </Song> 3.1. (25 points) Write an XSLT stylesheet that reads in <Song l g =’him’ g e n re =’classical’> Listing 1) and produces a list of songs in which Sgr <Sgr name=’J Prasad’/> is a subelement of Song and the genre attribute of Ajahoon Na Bhejiho 20 </Song> Sgr are placed as an attribute on Song (see Listing 3). <Song l g =’pa’ g e nr e =’classical’> Notice the text is Document your answer. <Sgr name=’J Prasad’/> Don’t over-do the use of fancy constructs. You Mera Dil Darda </Song> 25 should be able to get a lot done with just <Song l g =’en’ g e nr e =’classical’> xsl:template, xsl:apply-templates, xsl:copy, xsl:value- <Sgr name=’J Prasad’/> of, and xsl:copy-of. Never a Result </Song> </ SongList> 30 ¦ ¥ c February 8, 2005 Munindar P. Singh.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us