|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Is it possible for example with the XML below use XSL to display each <cd> listing but only the <artist> and <title> then have a read more link below each <cd> to display all the info for that particular CD???? If so where to start??
Code:
<catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> Also I know how to select data that matches certain criteria.. but how would you go about selecting everything that doesnt match a certain criteria.. for example selecting every <cd> that doesn't have a <artist> value of 'Bob Dylan'?? Any help appreciated.. Thanks |
|
#2
|
|||
|
|||
|
In answer to your second question i.e. output all except
Bob Dylan, here is a simple example: Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/">
<xsl:apply-templates select="/catalog/cd/artist" />
</xsl:template>
<xsl:template match="/catalog/cd/artist">
<xsl:if test="not(contains(., 'Bob Dylan'))">
Artist: <xsl:value-of select="."/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Read More link/Excluding certain Data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|