| View previous topic :: View next topic |
| Author |
Message |
Anonymous Guest
|
Posted: Wed Jan 04, 2006 3:18 pm Post subject: status modifcation |
|
|
Hi,
I am no expert in xsl style sheets.
But would like to have a xsl sheet displaying certain information e.g. song info. I have modified an existing sheet that is nearly doing what i want. The only thing I can not figure out is how to get the details for a specific mount point. This sheet produce the information for all mountpoints. Can some one help me how to modify this sheet that it shows only the information from 1 mountpoint instead of all connected mounts.
The xsl sheet:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
<xsl:for-each select="source">
<xsl:value-of select="@mount" /> - <xsl:value-of select="name" /> <xsl:value-of select="description" /> <xsl:value-of select="artist" /> <xsl:value-of select="title" /> <xsl:value-of select="url" />[#]
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet>
Thanks in advance!
RoN |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Jan 04, 2006 4:28 pm Post subject: |
|
|
You'll have to be more selective within the for-each, to match on only a specific mountpoint name. I'm not an xslt guru myself so I can't remember if the xsl:if will be sufficient but I think it is.
karl. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 05, 2006 2:06 pm Post subject: |
|
|
Karl,
Thanks for your reply!
I do think your gues is correct, however I cannot get this to work.
When i try something like this ... i get no result
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
<xsl:for-each select="source">
<xsl:if test=”/mount1”>
<xsl:value-of select="@mount" /> : <xsl:value-of select="artist" /> <xsl:value-of select="title" />.
</xsl:if>
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet>
I have no clue how to proceed, hope someone can help me to solve this puzzle.
RoN |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jan 05, 2006 2:37 pm Post subject: |
|
|
I'm only guessing here but maybe it's
<xsl:if test="@mount='/mount1'">
karl. |
|
| Back to top |
|
 |
MikeS Code Warrior

Joined: 29 Jun 2005 Posts: 73 Location: Barcelona, Spain
|
Posted: Thu Jan 05, 2006 3:21 pm Post subject: |
|
|
| Anonymous wrote: |
<xsl:for-each select="source">
<xsl:if test=”/mount1”>
|
I suspect you should replace the chunk above with something like:
<xsl:for-each select="source[@mount='mount1']">
...
</xsl:for-each>
... but I haven't written any XSLT for a while, so I might have some details wrong there.
Mike |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Fri Jan 06, 2006 8:38 pm Post subject: |
|
|
Karl & Mike,
Thanks for your help!
The advice form Mike did the job ..... I need to learn more from XSLT ...
but for now it does exactly what I want.
I'm a happy camper
The complet script is now .....
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
<xsl:for-each select="source[@mount='/mount']">
<xsl:value-of select="artist" /> <xsl:value-of select="title" />
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet> |
|
| Back to top |
|
 |
|