Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2006, 03:08 PM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL Attribute ID

here is my xml:

<videos>
  <movievideos>

   <video id="1" type="movie video" fullLengh="true">
     <title>my music video 1</title>
   </video>

   <video id="1" type="movie video" fullLengh="false">
     <title>my music video 2</title>
   </video>

  <movievidoes>
</videos>

----------------------------------------------

i want following dispaly output:

 My music video 1 ( Full lenght video image )--which is true in
attribute

 my music video 2 ( video clip image )

----

My XSL:


<xsl:for-each select="videos/musicVideos/video">
  <xsl:if test="position() < $maxvideo+1">

<table>
<tr>
<td width="399" valign="top"> <a
href="javascript:launchVspot('vid={@id}');">
                                              <xsl:value-of select="title"
disable-output-escaping="yes"/>

      <img src="full_length.gif" alt="Full Length"/>

      </a>
<tr>
</td>

</if>
</foreach>


it display the output with 2 title but only shows full_legth.gif image
on both the title:

Mine output is:

 my video title 1 ( full_lengh.gif )
 my video title 2 ( full_lengh.gif )


I want:
 my video title 1 ( full_lengh.gif )
 my video title 2 ( short_clips.gif )

so my question is how can i use fullLength attribute in xsl. so that i
can get the full lengh image if full video and video clip image if clips

Thanks,
jonty



_______________________
 
Old March 28th, 2006, 03:53 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Just do

<img src="{@fullLength}">

It's called an attribute value template.

Don't do this:

disable-output-escaping="yes"

It can get you into all sorts of difficulties. Fortunately in your case it doesn't cause any problems because there are no special characters in your text and therefore no escaping would happen anyway.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excluding attribute from xsl:coy-of ricksj XSLT 1 October 6th, 2008 04:56 PM
escaping of characters in xsl:attribute pramod Classic ASP XML 1 September 12th, 2008 09:11 AM
<xsl:attribute> vs {} berna_isct XSLT 1 April 6th, 2006 03:30 PM
XSLT change class attribute by ID? matallen XSLT 8 March 1st, 2006 05:00 PM
onClick as xsl attribute? mlaba XSLT 1 September 10th, 2004 02:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.