[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XPath question.

Subject: RE: XPath question.
From: "Hemi Kara" <hemi@xxxxxxxxxxxxx>
Date: Wed, 7 May 2003 21:44:54 +1200
xpath img src
Do you check that the "title" or "episode" elements value, is uppercase or
lowercase, you are at the moment testing on an uppercase "Q".

By the way, I cannot access your xml spec, so I don't really know what steps
are taken before you apply the if test, can you not attach a snapshot of the
xml file the stylesheet uses?, just zip it up. Will give a much better idea
of what has to be done!

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ben Trafford
Sent: Wednesday, 7 May 2003 4:03 p.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  XPath question.



At 03:43 PM 5/7/2003 +1200, Hemi Kara wrote:
><xsl:if test="starts-with(encyclopedia/entry/title, 'Q') or
>starts-with(encyclopedia/entry/episode, 'Q')">

         I tried that, too. I was incorrect in my previous reply to Rob
Rohan -- if I put a 'not' in the expression, my text shows up.

         I'm posting the entire stylesheet here for your further perusal.
The XML document it applies to is available at:
http://www.shastamedia.com/anomaly/encyclopedia.xml with an associated
document fragment at http://www.shastamedia.com/anomaly/entries.xml.

         Any help is appreciated, because I'm stumped.

--->Ben

===========

<?xml version="1.0"?>
<!DOCTYPE xsl:transform [
<!ENTITY css SYSTEM "anomaly.css">
<!ENTITY nbsp "&#160;">
]>



<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'>
<!--
This stylesheet takes a file based on encyclopedia.dtd, and shoots out the
proper formatting for Anomaly MUSH's webpage.
Author: Ben Trafford (genesisweapon@xxxxxxxxx)
Date Created: 04.29.2003
Date Last Modified: 05.06.2003
-->

   <!-- $stylesheet-version is the version number of this stylesheet. -->
   <xsl:variable name='stylesheet-version' select="'1.0'" />
   <xsl:template match='encyclopedia'>
     <html>
       <head>
         <title>Anomaly TrekMUX</title>
                                 <base target="_self"></base>
                                 <link rel="stylesheet" href="anomaly.css"
type="text/css"></link>
                                 <link rel="stylesheet" title="default
stylesheet" media="screen"
href="http://anomaly.mushpark.com/test/Styles/AnomalyDefault.css"></link>
                         </head>
       <body bgcolor="#000000">
                         <table border="0" width="686" cellspacing="0"
cellpadding="0" height="20">
                                 <tr>
                                         <td width="38" align="right"
valign="top" height="20">
                                                 <p align="right"><img
border="0"
src="http://anomaly.mushpark.com/images/lcars-smallbullet-l1.gif"
width="36" height="18"></img></p>
                                         </td>
                                         <td width="701" align="left"
valign="top" height="20"> <img border="0"
src="http://anomaly.mushpark.com/images/lcars-shortbar-1.gif" width="700"
height="18"></img></td>
                                         <td width="43" height="20"
valign="top" align="left">
                                                 <p align="center"><img
border="0"
src="http://anomaly.mushpark.com/images/lcars-smallbullet-r1.gif"
align="left" width="36" height="18"></img></p>
                                         </td>
                                 </tr>
                                 <tr>
                                         <td width="38" align="right"
valign="top" height="20">
                                                 <p align="center"></p></td>
                                         <td width="696" align="left"
valign="top" height="20">
                                         <script language="javascript">
<!--
function popupsug(id1) {
   popupWin =
window.open(id1,'Suggest','width=650,height=600,status=yes,resizable=yes,scr
ollbars=yes')
}
-->
                                         </script>
                                         <br></br>
                                         <center>
                                                 <table width="95%"
border="0">
                                                         <tr>
                                                                 <td>
                                                                         <p
align="center">

<a
href="A.html">A</a>-

<a
href="B.html">B</a>-

<a
href="C.html">C</a>-

<a
href="D.html">D</a>-

<a
href="E.html">E</a>-

<a
href="F.html">F</a>-

<a
href="G.html">G</a>-

<a
href="H.html">H</a>-

<a
href="I.html">I</a>-

<a
href="J.html">J</a>-

<a
href="K.html">K</a>-

<a
href="L.html">L</a>-

<a
href="M.html">M</a>-

<a
href="N.html">N</a>-

<a
href="O.html">O</a>-

<a
href="P.html">P</a>-

<a
href="Q.html">Q</a>-

<a
href="R.html">R</a>-

<a
href="S.html">S</a>-

<a
href="T.html">T</a>-

<a
href="U.html">U</a>-

<a
href="V.html">V</a>-

<a
href="W.html">W</a>-

<a
href="X.html">X</a>-

<a
href="Y.html">Y</a>-

<a
href="Z.html">Z</a>

</p>
                                                                         <p
align="center">Alphabetical Title Goes Here</p>
                                                                 </td>
                                                         </tr>
                                                         <tr>
                                                                 <td>


<form
method="post" action="encyclopedia/sort.cgi">

<div
align="center"><font face="verdana" size="1">Search

<select
name="cat">

<option
value="0">All</option>

<option
value='1'> Episodes</option>

<option
value='2'> Stars</option>

<option
value='3'> Guest Stars</option>

<option
value='4'> Species</option>

<option
value='5'> Ships</option>

<option
value='6'> Place</option>

<option
value='7'> Science</option>

<option
value='8'> Miscellaneous</option>

</select>

for:</font>

<input
type="text" name="search" size="25"></input>

<input
type="submit" name="Go" style="font-size: 8pt; font-family: verdana; color:
#FFFFFF; font-weight: bold; background-color: #000045" value="Go"></input>

</div>

</form>
                                                                 </td>
                                                         </tr>
                                                         <tr>
                                                                 <td>
                                                                 <xsl:if
test="starts-with(encyclopedia/entry/title, 'Q') or
starts-with(encyclopedia/entry/episode, 'Q')">
                    <xsl:call-template name="no.entry.found"/>
                 </xsl:if>

                                 <!-- Apply the usual template if a title
or episode matches Q, otherwise, don't -->

                                                 <xsl:apply-templates>
                                                         <xsl:sort
select="title|episode"/>
                                                 </xsl:apply-templates>
                                                                 </td>
                                                         </tr>
                                                 </table>
                                         </center>
                                 </td>
                                 </tr>
                                 </table>
                                 <table border="0" width="734"
cellspacing="0" cellpadding="0" height="20">
                                           <tr>
                                             <td width="36" align="right"
valign="top" height="20">
                                               <p align="right"><img
border="0" src="images/lcars-bullet-l2.gif" width="36"
height="36"></img></p>
                                             </td>
                                             <td width="701" align="left"
valign="top" height="20"> <img border="0"
src="http://anomaly.mushpark.com/images/lcars-bottom-2.gif" width="700"
height="36"></img></td>
                                             <td width="44" height="20"
valign="top" align="left">
                                               <p align="center"><img
border="0" src="images/lcars-bullet-r1.gif" align="left" width="36"
height="36"></img></p>
                                             </td>
                                           </tr>
                                 </table>
               </body>
     </html>
   </xsl:template>

         <xsl:template name="no.entry.found">
                 <br></br><br></br>
                         <table width="95%" cellspacing="0" cellpadding="0"
border="0" align="center">
                                 <tr>
                                         <td>
                                                 <!-- temporary test
code -->


                                                 <p align="center"><font
face="verdana" size="2">
                                                         There are no items
at present, please check back again soon.</font>
                                                 </p>
                                                 <br></br><br></br>
                                                 <p align="center">
                                                         <hr
width="75"></hr>
                                                 </p>
                                         </td>
                                 </tr>
                         </table>
         </xsl:template>

         <xsl:template match="entry">
                 <xsl:if test="starts-with(title, 'Q') or
starts-with(episode, 'Q')">
         <table width="95%" cellspacing="0" cellpadding="0" border="0"
align="center">
                 <xsl:apply-templates/>
                                 </table>
                                 <br></br><br></br><br></br>
       </xsl:if>
         </xsl:template>

         <xsl:template match="episode">
                 <tr bgcolor="#FF9900">
         <td align="left" colspan="2" height="20">
                         <font face="verdana" size="2" color="black">
                                 <strong>
                                                 <xsl:apply-templates/>
                                         </strong> &nbsp; &nbsp;
                                 </font>
                                 <a name="{../@id}"></a>
                         </td>
                 </tr>
         </xsl:template>

         <xsl:template match="title">
                 <tr bgcolor="#FF9900">
         <td align="left" colspan="2" height="20">
                         <font face="verdana" size="2" color="black">
                                 <strong>
                                                 <xsl:apply-templates/>
                                         </strong> &nbsp; &nbsp;
                                 </font>
                         <a name="{../@id}"></a>
                         </td>
                 </tr>
         </xsl:template>

         <xsl:template match="body">
                 <tr>
                         <td align="left" colspan="2">
                                 <font face="verdana" size="2">
                                         <xsl:apply-templates/>
                                 </font>
                         </td>
                 </tr>
         </xsl:template>

         <xsl:template match="paragraph">
                 <p>
                         <font face="verdana" size="2">
                                 <xsl:apply-templates>
                                 </xsl:apply-templates>
                         </font>
                 </p>
         </xsl:template>

         <xsl:template match="entry.links">
                                 <b>SEE ALSO:
                                 <xsl:apply-templates>
                                         <xsl:sort select="@to.entry"/>
                                 </xsl:apply-templates>.</b>
         </xsl:template>

         <xsl:template match="entry.link">
                                                 <i><a
href="#{@to.entry}"><xsl:apply-templates/></a>
                                                 <xsl:if
test="not(position()=last())">; </xsl:if>
                                                 </i>
   </xsl:template>

         <xsl:template match="standalone.entry.link">
                 <b>SEE ALSO: <i><a
href="#{@to.entry}"><xsl:apply-templates/></a>. </i></b>
         </xsl:template>


         <xsl:template match="episode.link">
                 <i>(<a class="episode.link"
href="#{@to.episode}"><xsl:apply-templates/></a>) </i>
         </xsl:template>

   <xsl:template match="img">
         <xsl:if test="not(@alt.text)">
                         <xsl:choose>
                                 <xsl:when test="@width">
                                 <img src="{@src}" alt="{../../../title}"
border="0" align="{@align}" width="{@width}"></img>
                         </xsl:when>
                                 <xsl:otherwise>
                                 <img src="{@src}" alt="{../../../title}"
border="0" align="{@align}"></img>
                         </xsl:otherwise>
                   </xsl:choose>
         </xsl:if>
         <xsl:if test="@alt.text">
                                 <xsl:choose>
                                 <xsl:when test="@width">
                                         <img src="{@src}"
alt="{@alt.text}" border="0" align="{@align}" width="{@width}"></img>
                                 </xsl:when>
                                 <xsl:otherwise>
                                 <img src="{@src}" alt="{@alt.text}"
border="0" align="{@align}"></img>
                         </xsl:otherwise>
                   </xsl:choose>
                 </xsl:if>
   </xsl:template>




   <xsl:template match="header">
         <b><xsl:apply-templates/><br/></b>
   </xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.