Meeskond "Nope": Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 744: | Line 744: | ||
</xsl:stylesheet> | </xsl:stylesheet> | ||
</pre> | |||
===XSD=== | |||
<pre> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||
<xs:element name="music"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="artists"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="artist"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="album"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="description" type="xs:string" /> | |||
<xs:element name="albumCover"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="ImageUrl" type="xs:string" /> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="songs"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="song"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="lyrics"> | |||
<xs:complexType mixed="true"> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="br" /> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element minOccurs="0" name="genres"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="genre" type="xs:string" /> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute name="name" type="xs:string" use="required" /> | |||
<xs:attribute name="duration" type="xs:string" use="required" /> | |||
<xs:attribute name="durationUnit" type="xs:string" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element minOccurs="0" name="genres"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="genre" type="xs:string" /> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute name="name" type="xs:string" use="required" /> | |||
<xs:attribute name="releaseDate" type="xs:unsignedShort" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute name="id" type="xs:unsignedLong" use="required" /> | |||
<xs:attribute name="name" type="xs:string" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:schema> | |||
</pre> | </pre> |
Revision as of 00:02, 20 March 2017
Meeskond
- Raido Vell
- Taavi Vesinurm
- Kaspar Kaal
- Lisette Noor
- Madis Roosioks
Idee
XML Fail
XML
<?xml version="1.0" encoding="utf-8" ?> <music> <artists> <artist id="1" name="Michael Jackson"> <album name="Thriller" releaseDate="1982"> <description> Thriller is the sixth studio album by American singer Michael Jackson, released on November 30, 1982 by Epic Records. The follow-up to Jackson's successful previous album, Off the Wall (1979), Thriller explores genres similar to those of its predecessor, including pop, post-disco, rock and funk. </description> <albumCover> <ImageUrl>https://upload.wikimedia.org/wikipedia/en/5/55/Michael_Jackson_-_Thriller.png</ImageUrl> </albumCover> <songs> <song name="Billie Jean" duration="4:54" durationUnit="minutes:seconds"> <lyrics> She was more like a beauty queen from a movie scene<br/> I said don't mind, but what do you mean I am the one<br/> Who will dance on the floor in the round<br/> She said I am the one who will dance on the floor in the round<br/> She told me her name was Billie Jean, as she caused a scene<br/> Then every head turned with eyes that dreamed of being the one<br/> Who will dance on the floor in the round<br/> People always told me be careful of what you do<br/> And don't go around breaking young girls' hearts<br/> And mother always told me be careful of who you love<br/> And be careful of what you do 'cause the lie becomes the truth<br/> Billie Jean is not my lover<br/> She's just a girl who claims that I am the one<br/> But the kid is not my son<br/> She says I am the one, but the kid is not my son<br/> For forty days and forty nights<br/> The law was on her side<br/> But who can stand when she's in demand<br/> Her schemes and plans<br/> 'cause we danced on the floor in the round<br/> So take my strong advice, just remember to always think twice<br/> (do think twice.)<br/> She told my baby we'd danced 'til three<br/> Then she looked at me<br/> She showed a photo of a baby crying<br/> His eyes looked like mine<br/> Go on dance on the floor in the round, baby<br/> People always told me be careful of what you do<br/> And don't go around breaking young girls' hearts<br/> She came and stood right by me<br/> Then the smell of sweet perfume<br/> This happened much too soon<br/> She called me to her room<br/> Billie Jean is not my lover<br/> She's just a girl who claims that I am the one<br/> But the kid is not my son<br/> Billie Jean is not my lover<br/> She's just a girl who claims that I am the one<br/> But the kid is not my son<br/> She says I am the one, but the kid is not my son<br/> She says I am the one, but the kid is not my son<br/> Billie Jean is not my lover<br/> She's just a girl who claims that I am the one<br/> But the kid is not my son<br/> She says I am the one, but the kid is not my son<br/> She says I am the one, she says he is my son<br/> She says I am the one<br/> Billie Jean is not my lover<br/> Billie Jean is not my lover<br/> </lyrics> <genres> <genre>Post-disco</genre> <genre>Rhythm and Blues</genre> <genre>Funk</genre> <genre>Dance-Pop</genre> </genres> </song> <song name="Thriller" duration="5:58" durationUnit="minutes:seconds"> <lyrics> It's close to midnight and something evil's lurking<br/> In the dark<br/> Under the moonlight you see a sight that almost stops<br/> Your heart<br/> You try to scream, but terror takes the sound before<br/> You make it<br/> You start to freeze as horror looks you right between<br/> The eyes<br/> You're paralyzed<br/> 'Cause this is thriller, thriller night<br/> And no one's gonna save you from the beast about to<br/> Strike<br/> You know it's thriller, thriller night<br/> You're fighting for your life inside a killer<br/> Thriller tonight<br/> You hear the door slam and realize there's nowhere<br/> Left to run<br/> You feel the cold hand and wonder if you'll ever see<br/> The sun<br/> You close your eyes and hope that this is just<br/> Imagination<br/> But all the while you hear the creature creepin' up<br/> Behind<br/> You're out of time<br/> 'Cause this is thriller, thriller night<br/> There ain't no second chance against the thing with<br/> Forty eyes<br/> You know it's thriller, thriller night<br/> You're fighting for your life inside a killer<br/> Thriller tonight<br/> Night creatures call<br/> And the dead start to walk in their masquerade<br/> There's no escapin' the jaws of the alien this time<br/> (They're open wide)<br/> This is the end of your life<br/> They're out to get you; there's demons closing in on<br/> Every side<br/> They will possess you unless you change the number on<br/> Your dial<br/> Now is the time for you and I to cuddle close<br/> Together<br/> All through the night I'll save you from the terrors on<br/> The screen<br/> I'll make you see<br/> That it's a thriller, thriller night<br/> 'Cause I can thrill you more than any ghost<br/> Would ever dare try<br/> Girl, this is thriller, thriller night<br/> So let me hold you tight and share a killer, diller<br/> Chiller<br/> Thriller here tonight<br/> That it's a thriller, thriller night<br/> 'Cause I can thrill you more than any ghost<br/> Would ever dare try<br/> Girl, this is thriller, thriller night<br/> So let me hold you tight and share a killer, diller<br/> Darkness falls across the land<br/> The midnight hour is close at hand<br/> Creatures crawl in search of blood<br/> To terrorize y'awl's neighborhood<br/> And whosoever shall be found<br/> Without the soul for getting down<br/> Must stand and face the hounds of hell<br/> And rot inside a corpse's shell<br/> The foulest stench is in the air<br/> The funk of forty thousand years<br/> And grizzly ghouls from every tomb<br/> Are closing in to seal your doom<br/> And though you fight to stay alive<br/> Your body starts to shiver<br/> For no mere mortal can resist<br/> The evil of the thriller<br/> </lyrics> <genres> <genre>Disco</genre> <genre>Pop</genre> </genres> </song> <song name="Beat it" duration="4:18" durationUnit="minutes:seconds"> <lyrics> They told him don't you ever come around here<br/> Don't wanna see your face, you better disappear<br/> The fire's in their eyes and their words are really clear<br/> So beat it, just beat it<br/> You better run, you better do what you can<br/> Don't wanna see no blood, don't be a macho man<br/> You wanna be tough, better do what you can<br/> So beat it, but you wanna be bad<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it (beat it)<br/> Just beat it (beat it)<br/> Just beat it (beat it)<br/> Just beat it (beat it uuh)<br/> They're out to get you, better leave while you can<br/> Don't wanna be a boy, you wanna be a man<br/> You wanna stay alive, better do what you can<br/> So beat it, just beat it<br/> You have to show them that you're really not scared<br/> You're playin' with your life, this ain't no truth or dare<br/> They'll kick you, then they'll beat you<br/> Then they'll tell you it's fair<br/> So beat it, but you wanna be bad<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it (beat it)<br/> Beat it (beat it)<br/> Beat it (beat it)<br/> Beat it (beat it)<br/> Beat it (beat it)<br/> Beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it, beat it, beat it, beat it<br/> No one wants to be defeated<br/> Showin' how funky and strong is your fight<br/> It doesn't matter who's wrong or right<br/> Just beat it (beat it)<br/> </lyrics> <genres> <genre>Hard Rock</genre> <genre>Dance-Rock</genre> </genres> </song> </songs> </album> </artist> <artist name="Imagine Dragons" id="2"> <album name="Smoke + Mirrors" releaseDate="2015"> <description> Smoke + Mirrors is the second studio album by American rock band Imagine Dragons. The album was recorded during 2014 at the band's home studio in Las Vegas, Nevada. </description> <albumCover> <ImageUrl>https://upload.wikimedia.org/wikipedia/en/c/ce/Imagine_Dragons_-_Smoke_%2B_Mirrors.png</ImageUrl> </albumCover> <songs> <song name="Shots" duration="3:52" durationUnit="minutes:seconds"> <lyrics> I'm sorry for everything<br/> Oh, everything I've done<br/> Am I out of touch?<br/> Am I out of my place?<br/> When I keep saying that I'm looking for an empty space<br/> Oh, I'm wishing you're here<br/> But I'm wishing you're gone<br/> I can't have you and I'm only gonna do you wrong<br/> Oh, I'm going to mess this up<br/> Oh, this is just my luck<br/> Over and over and over again<br/> I'm sorry for everything<br/> Oh, everything I've done<br/> From the second that I was born it seems I had a loaded gun<br/> And then I shot, shot, shot a hole through everything I loved<br/> Oh, I shot, shot, shot a hole through every single thing that I loved<br/> Am I out of luck?<br/> Am I waiting to break?<br/> When I keep saying that I'm looking for a way to escape<br/> Oh, I'm wishing I had what I'd taken for granted<br/> I can't help you when I'm only gonna do you wrong<br/> Oh, I'm going to mess this up<br/> Oh, this is just my luck<br/> Over and over and over again<br/> I'm sorry for everything<br/> Oh, everything I've done<br/> From the second that I was born it seems I had a loaded gun<br/> And then I shot, shot, shot a hole through everything I loved<br/> Oh, I shot, shot, shot a hole through every single thing that I loved<br/> In the meantime we let it go<br/> At the roadside<br/> We used to know<br/> We can let this drift away<br/> Oh, we let this drift away<br/> At the bay side<br/> You used to show<br/> In the moonlight<br/> We let it go<br/> We can let this drift away<br/> Oh, we let this drift away<br/> And there's always time to change your mind<br/> Oh, there's always time to change your mind<br/> Oh, love, can you hear me?<br/> Oh, let it drift away<br/> I'm sorry for everything<br/> Oh, everything I've done<br/> From the second that I was born it seems I had a loaded gun<br/> And then I shot, shot, shot a hole through everything I loved<br/> Oh, I shot, shot, shot a hole through every single thing that I loved<br/> In the meantime we let it go<br/> At the roadside<br/> We used to know<br/> We can let this drift away<br/> Oh, we let this drift away<br/> At the bay side<br/> You used to show<br/> In the moonlight<br/> We let it go<br/> We can let this drift away<br/> Oh, we let this drift away<br/> And there's always time to change your mind<br/> Oh, there's always time to change your mind<br/> Oh, love, can you hear me?<br/> Oh, let it drift away<br/> </lyrics> <genres> <genre>Dance-rock</genre> <genre>Synthpop</genre> </genres> </song> <song name="I Bet My Life" duration="3:14" durationUnit="minutes:seconds"> <lyrics> I know I took the path that you would never want for me<br/> I know I let you down, didn't I?<br/> So many sleepless nights where you were waiting up on me<br/> Well I'm just a slave unto the night<br/> Now remember when I told you that's the last you'll see of me<br/> Remember when I broke you down to tears<br/> I know I took the path that you would never want for me<br/> I gave you hell through all the years<br/> So I, I bet my life, I bet my life<br/> I bet my life on you<br/> I, I bet my life, I bet my life<br/> I bet my life on you<br/> I've been around the world and never in my wildest dreams<br/> Would I come running home to you<br/> I've told a million lies but now I tell a single truth<br/> There's you in everything I do<br/> Now remember when I told you that's the last you'll see of me<br/> Remember when I broke you down to tears<br/> I know I took the path that you would never want for me<br/> I gave you hell through all the years<br/> So I, I bet my life, I bet my life<br/> I bet my life on you<br/> I, I bet my life, I bet my life<br/> I bet my life on you<br/> Don't tell me that I'm wrong<br/> I've walked that road before<br/> And left you on your own<br/> And please believe them when they say<br/> That it's left for yesterday<br/> And the records that I've played<br/> Please forgive me for all I've done<br/> So I, I bet my life, I bet my life<br/> I bet my life on you<br/> I, I bet my life, I bet my life<br/> I bet my life on you<br/> So I, I bet my life, I bet my life<br/> I bet my life on you<br/> I, I bet my life, I bet my life<br/> I bet my life on you<br/> </lyrics> <genres> <genre>Folk Rock</genre> <genre>Alternative Rock</genre> </genres> </song> <song name="Gold" duration="3:37" durationUnit="minutes:seconds"> <lyrics> First comes the blessing of all that you've dreamed,<br/> But then comes the curses of diamonds and rings.<br/> Only at first did it have its appeal, but now you can't tell the false from the real.<br/> Who can you trust?<br/> (Who can you trust?)<br/> When everything, everything, everything you touch turns to gold, gold, gold.<br/> When everything, everything, everything you touch turns to gold, gold<br/> (Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa)<br/> Statues and empires are all at your hands,<br/> Water to wine and the finest of sands.<br/> When all that you have's turning stale and it's cold,<br/> Oh, you'll no longer feel when your heart's turned to gold.<br/> Who can you trust<br/> (Who can you trust)<br/> When everything, everything, everything you touch turns to gold, gold, gold.<br/> When everything, everything, everything you touch turns to gold, gold<br/> (Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa)<br/> I'm dying to feel again,<br/> Oh, anything at all,<br/> But, oh, I feel nothin', nothin', nothin', nothin'<br/> When everything, everything, everything you touch turns to gold, gold, gold.<br/> When everything, everything, everything you touch turns to gold, gold<br/> (Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa<br/> Ooh, gold, whoa)<br/> </lyrics> </song> <genres> <genre>Alternative Rock</genre> <genre>Indie Rock</genre> </genres> </songs> </album> </artist> <artist name="Of Monsters and Men" id="3"> <album name="My Head Is an Animal" releaseDate="2011"> <description> My Head Is an Animal is the debut studio album by the Icelandic indie folk band Of Monsters and Men, released through Record Records in Iceland on 20 September 2011. After their success, topping the Icelandic charts with their debut single, "Little Talks", the band signed with Universal Music Group and the album was released in North America through Republic Records on 3 April 2012. The title of the album comes from the second line in "Dirty Paws". </description> <albumCover> <ImageUrl>https://upload.wikimedia.org/wikipedia/en/0/07/My_Head_Is_An_Animal.jpg</ImageUrl> </albumCover> <songs> <song name="Dirty Paws" duration="4:38" durationUnit="minutes:seconds"> <lyrics> Jumping up and down the floor, my head is an animal<br/> And once there was an animal, it had a son that mowed the lawn<br/> The son was an ok guy<br/> They had a pet dragonfly<br/> The dragonfly, it ran away<br/> But it came back with a story to say<br/> Her dirty paws and furry coat, she ran down the forest slope<br/> The forest of talking trees, they used to sing about the birds and the bees<br/> The bees had declared a war - the sky wasn't big enough for them all<br/> The birds, they got help from below<br/> From dirty paws and the creatures of snow<br/> And for a while things were cold, they were scared down in their holes<br/> The forest that once was green was coloured black by those killing machines<br/> But she and her furry friends took down the queen bee and her men<br/> And that's how the story goes, the story of the beast with those four dirty paws<br/> </lyrics> <genres> <genre>Indie Rock</genre> <genre>Alternative Rock</genre> </genres> </song> <song name="Little Talks" duration="4:26" durationUnit="minutes:seconds"> <lyrics> Hey! Hey! Hey!<br/> I don't like walking around this old and empty house<br/> So hold my hand, I'll walk with you, my dear<br/> The stairs creak as you sleep, it's keeping me awake<br/> It's the house telling you to close your eyes<br/> And some days I can't even dress myself<br/> It's killing me to see you this way<br/> 'Cause though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Hey! Hey! Hey!<br/> There's an old voice in my head that's holding me back<br/> Well tell her that I miss our little talks<br/> Soon it will be over and buried with our past<br/> We used to play outside when we were young<br/> And full of life and full of love.<br/> Some days I don't know if I am wrong or right<br/> Your mind is playing tricks on you, my dear<br/> 'Cause though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Hey!<br/> Don't listen to a word I say<br/> Hey!<br/> The screams all sound the same<br/> Hey!<br/> Though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Hey!<br/> Hey!<br/> You're gone, gone, gone away<br/> I watched you disappear<br/> All that's left is the ghost of you.<br/> Now we're torn, torn, torn apart,<br/> There's nothing we can do<br/> Just let me go we'll meet again soon<br/> Now wait, wait, wait for me<br/> Please hang around<br/> I'll see you when I fall asleep<br/> Hey!<br/> Don't listen to a word I say<br/> Hey!<br/> The screams all sound the same<br/> Hey!<br/> Though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Don't listen to a word I say<br/> Hey!<br/> The screams all sound the same<br/> Hey!<br/> Though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> Though the truth may vary<br/> This ship will carry our bodies safe to shore<br/> </lyrics> <genres> <genre>Indie Pop</genre> <genre>Indie Folk</genre> </genres> </song> <song name="King And Lionheart" duration="4:33" durationUnit="minutes:seconds"> <lyrics> Taking over this town they should worry,<br/> But these problems aside I think I taught you well.<br/> That we won't run, and we won't run, and we won't run.<br/> And in the winter night sky ships are sailing,<br/> Looking down on these bright blue city lights.<br/> And they won't wait, and they won't wait, and they won't wait.<br/> We're here to stay, we're here to stay, we're here to stay.<br/> Howling ghosts – they reappear<br/> In mountains that are stacked with fear<br/> But you're a king and I'm a lionheart.<br/> A lionheart.<br/> His crown lit up the way as we moved slowly<br/> Past the wondering eyes of the ones that were left behind.<br/> Though far away, though far away, though far away<br/> We're still the same, we're still the same, we're still the same.<br/> Howling ghosts – they reappear<br/> In mountains that are stacked with fear<br/> But you're a king and I'm a lionheart.<br/> And in the sea that's painted black,<br/> Creatures lurk below the deck<br/> But you're a king and I'm a lionheart.<br/> And as the world comes to an end<br/> I'll be here to hold your hand<br/> 'Cause you're my king and I'm your lionheart.<br/> A lionheart.<br/> Howling ghosts – they reappear<br/> In mountains that are stacked with fear<br/> But you're a king and I'm a lionheart.<br/> And in the sea that's painted black,<br/> Creatures lurk below the deck<br/> But you're a king and I'm a lionheart.<br/> A lionheart.<br/> </lyrics> <genres> <genre>Alternative Rock</genre> <genre>Indie Rock</genre> </genres> </song> </songs> </album> </artist> </artists> </music>
XSLT-HTML
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <head> <title>Muusika</title> </head> <body> <h1> 2015 and newer albums </h1> <table border="1"> <tr> <th> <xsl:text>Artist</xsl:text> </th> <th> <xsl:text>Album</xsl:text> </th> <th> <xsl:text>Songs</xsl:text> </th> <th> <xsl:text>Album cover</xsl:text> </th> </tr> <xsl:for-each select="/music/artists/artist/album"> <xsl:if test="@releaseDate > 2014"> <xsl:for-each select="../."> <tr> <th> <xsl:value-of select="@name"/> </th> <xsl:for-each select="album"> <td> <xsl:value-of select="@name"/> <br/> <xsl:text> Release year: </xsl:text> <xsl:value-of select="@releaseDate"/> </td> <td> <xsl:for-each select="songs/song"> <xsl:value-of select="@name"/> <xsl:text> (</xsl:text> <xsl:value-of select="@duration"/> <xsl:text> </xsl:text> <xsl:value-of select="@durationUnit"/> <xsl:text>)</xsl:text> <br/> </xsl:for-each> </td> <td> <xsl:for-each select="albumCover/ImageUrl"> <xsl:variable name="img" select="."/> <img src="{$img}"></img> </xsl:for-each> </td> </xsl:for-each> </tr> </xsl:for-each> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
XSLT-XML
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:text>Muusika kataloog</xsl:text> <xsl:for-each select="artist[@id]"> <xsl:text></xsl:text> <xsl:for-each select="artist/name"> <xsl:text></xsl:text> <xsl:value-of select="album[@name][@releaseDate]" /> <xsl:text></xsl:text> <xsl:text></xsl:text> </xsl:for-each> <xsl:value-of select="album/title"/> <xsl:text></xsl:text> <xsl:value-of select="album/description"/> <xsl:text></xsl:text> <img> <xsl:attribute name="albumCover"> <xsl:value-of select="albumCover/ImageUrl"/> </xsl:attribute> </img> <xsl:for-each select="Songs/song"> <xsl:text></xsl:text> <xsl:value-of select="song[@duration][@durationUnit]"/> <xsl:text></xsl:text> <xsl:text></xsl:text> <xsl:value-of select="song/title"/> <xsl:text></xsl:text> <xsl:value-of select="song/lyrics"/> <xsl:text></xsl:text> </xsl:for-each> <xsl:for-each select="genres/genre"> <xsl:value-of select="genre"/> <xsl:text></xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>
XSD
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="music"> <xs:complexType> <xs:sequence> <xs:element name="artists"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="artist"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="album"> <xs:complexType> <xs:sequence> <xs:element name="description" type="xs:string" /> <xs:element name="albumCover"> <xs:complexType> <xs:sequence> <xs:element name="ImageUrl" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="songs"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="song"> <xs:complexType> <xs:sequence> <xs:element name="lyrics"> <xs:complexType mixed="true"> <xs:sequence> <xs:element maxOccurs="unbounded" name="br" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element minOccurs="0" name="genres"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="genre" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="duration" type="xs:string" use="required" /> <xs:attribute name="durationUnit" type="xs:string" use="required" /> </xs:complexType> </xs:element> <xs:element minOccurs="0" name="genres"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="genre" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="releaseDate" type="xs:unsignedShort" use="required" /> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:unsignedLong" use="required" /> <xs:attribute name="name" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
History
19.03.17 - Wiki Loodud
19.03.17 - Lisatud 2 * XSLT ja XML fail.