Angesichts der Probe (verkürzt) MythTV XML Programmführer: eine XSLT zu entwickelnXSLT Mit einem Knoten basierend auf Beseitigen von einem oder mehreren Textwerte in XML für Mythtv
<?xml version='1.0' encoding='utf-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body><ns1:downloadResponse SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns1='urn:TMSWebServices'>
<xtvdResponse xsi:type='ns1:xtvdResponse'>
<messages xsi:type='ns1:messages'>
<message>Your subscription will expire: 2017-07-25T05:40:43Z</message>
</messages>
<xtvd from='2016-06-28T00:00:01Z' to='2016-07-12T00:00:01Z' schemaVersion='1.3' xmlns='urn:TMSWebServices' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='urn:TMSWebServices http://dd.schedulesdirect.org/tech/xml/schemas/tmsxtvd.xsd'>
<program id='MV000084150000'>
<title>Across 110th Street</title>
<mpaaRating>R</mpaaRating>
<starRating>**+</starRating>
<runTime>PT01H42M</runTime>
<year>1972</year>
<description>Mobsters and crooked police (Anthony Quinn, Yaphet Kotto) hunt three hoods who have robbed a mob operation in Harlem.</description>
<advisories>
<advisory>Adult Situations</advisory>
<advisory>Language</advisory>
<advisory>Violence</advisory>
</advisories>
</program>
<program id='MV000083800000'>
<title>Conan the Barbarian</title>
<mpaaRating>R</mpaaRating>
<starRating>***</starRating>
<runTime>PT02H09M</runTime>
<year>1982</year>
<description>Pit fighter Conan (Arnold Schwarzenegger) sets out with a Mongol and a queen (Sandahl Bergman) to take his father's sword from a snake king (James Earl Jones).</description>
<advisories>
<advisory>Adult Situations</advisory>
<advisory>Nudity</advisory>
<advisory>Graphic Violence</advisory>
</advisories>
</program>
</xtvd>
</xtvdResponse>
</ns1:downloadResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Ich versuche, die eine vollständige entfernen wird <program>
Knoten, wenn die <advisory>
den Text "Nacktheit" oder "Kurze Nacktheit" enthält. Hier
ist, was ich habe versucht, nur zu adressieren „Nacktheit“:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="ISO-8859-1"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="program[descendant::advisory[text() = 'Nudity']]"/>
</xsl:stylesheet>
... aber es funktioniert nicht auf MythTV XML, obwohl, wenn ich den gleichen grundlegenden Ansatz versuchen, auf viel einfacher XML, es funktioniert:
<root>
<program>
<advisories>
<advisory>blabla</advisory>
</advisories>
</program>
<program>
<advisories>
<advisory>http://media.blabla.pdf</advisory>
</advisories>
</program>
<program>
<advisories>
<advisory>http://media2.blabla.pdf</advisory>
</advisories>
</program>
<program>
<advisories>
<advisory>http://media.otherblabla</advisory>
</advisories>
</program>
</root>
Als ich xsltproc laufen mit --verbose die XSLT auf dem einfachen XML anwenden, ich eine Ausgabe erhalten (xsltEvalXPathPredicate: Erträge 1) I aus dem MythTV XML nicht sehen, also denke ich, dass es eine XPath-Technik gibt, die ich anwenden muss, aber ich bin mir nicht sicher.
Kann jemand beraten, was zu tun ist, um dies zu lösen? Meine Absicht ist es zu dokumentieren, wie man einen kostenlosen Programmablauffilter erstellt, so dass bestimmte Shows einfach nicht auf dem MythTV-Angebot angeboten/angezeigt werden.
Awesome - so hilfreich - danke! –