I'm having problems understanding xslt. In my source document I have to find the inner text from a <p>
tag with the class attribute that is equal to "deck"
.
In my source xml somewhere:
<body>
<p class="deck">Text here</p>
... ... cut ... ... ...
In my xsl file
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:TimeInc="http://www.timeinc.com/namespaces/PAMTimeInc/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:prism="http://prismstandard.org/namespaces/basic/2.1/"
xmlns:pam="http://prismstandard.org/namespaces/pam/2.1/"
xmlns:pim="http://prismstandard.org/namespaces/pim/2.1/"
xmlns:prl="http://prismstandard.org/namespaces/prl/2.1/">
<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
<Description>
<xsl:choose>
<xsl:when test="//p@deck != ''">
<xsl:value-of select="//p@deck"/>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</Description>
... ... cut ... ... ...
It is obviously incorrect because I do not know what I'm doing. Is there an example somewhere as to how to do this or understand it more.