Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Based on a question asked by richierich in this thread, I created the following little XSLT script that transforms an exported XML collection file into an HTML report of all cast/crew with BY assigned. Save the code below as HasBY.xslt.Export your collection into an XML file.Open the XML file with a text editor and insert a <xml-stylesheet> tag referring HasBY.xslt right before the <Collection> root tag.Open the modified collection file with IE.Please note that this is just a quick-shot. There is no fancy, formatting, no elimination of duplicates, just some dull result tables. If someone wants to refine it, feel free to do so. File HasBY.xslt: Quote:
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2007 Matthias Wolf, Germany AKA goodguy http://www.geocities.com/goodguy_dvdpro/ -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/"> <html> <head> <title>Cast and Crew with BY</title> </head> <body> <h1>Cast and Crew with BY</h1> <h3>Cast</h3> <table border="1"> <tr> <th>ID</th><th>Title</th><th>FirstName</th><th>MiddleName</th><th>LastName</th><th>BY</th> </tr> <xsl:apply-templates select="/Collection/DVD/Actors/Actor[@BirthYear != 0]"> <xsl:sort select="@LastName"></xsl:sort> <xsl:sort select="@BirthYear"></xsl:sort> <xsl:sort select="@FirstName"></xsl:sort> <xsl:sort select="@MiddleName"></xsl:sort> <xsl:sort select="../../Title"></xsl:sort> </xsl:apply-templates> </table> <h3>Crew</h3> <table border="1"> <tr> <th>ID</th><th>Title</th><th>FirstName</th><th>MiddleName</th><th>LastName</th><th>BY</th> </tr> <xsl:apply-templates select="/Collection/DVD/Credits/Credit[@BirthYear != 0]"> <xsl:sort select="@LastName"></xsl:sort> <xsl:sort select="@BirthYear"></xsl:sort> <xsl:sort select="@FirstName"></xsl:sort> <xsl:sort select="@MiddleName"></xsl:sort> <xsl:sort select="../../Title"></xsl:sort> </xsl:apply-templates> </table> </body> </html> </xsl:template>
<xsl:template match="Actors/Actor[@BirthYear != 0] | Credits/Credit[@BirthYear != 0]"> <tr> <td><xsl:value-of select="../../ID"/></td> <td><xsl:value-of select="../../Title"/></td> <td><xsl:value-of select="@FirstName"/></td> <td><xsl:value-of select="@MiddleName"/></td> <td><xsl:value-of select="@LastName"/></td> <td><xsl:value-of select="@BirthYear"/></td> </tr> </xsl:template>
</xsl:stylesheet>
Insert this line into the exported XML collection file, right before the <Collection> tag. Replace the sample path with your real file path: Quote:
<?xml-stylesheet type="text/xsl" href="C:\Sample\HasBY.xslt"?>
| | | Matthias | | | Last edited: by goodguy |
|
Registered: March 13, 2007 | Posts: 2,692 |
| Posted: | | | | thanks for this. Should be very useful | | | Paul |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,022 |
| Posted: | | | | thanks Matt, will be very useful | | | |
|