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 July 3rd, 2007, 02:46 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Couple questions about embedding values into html

So I am having some slight issues.

How can I put values coming from the XML source into a node like so:

<img src="[someXSLTvalut]" />

Thanks

 
Old July 3rd, 2007, 02:59 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Almost right. You use an "attribute value template" - an XPath expression enclosed in curly brackets, for example

src="http://{$domain}/{name()}.jpeg"

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 3rd, 2007, 03:06 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[/code]
    <xsl:for-each select=".">
        <xsl:variable name='eventObj' select="./dates" />
        <xsl:for-each select="$eventObj/date">
            <xsl:variable name="firstDate" select="concat(substring($currentDate, 1,4),substring($currentDate, 6,2),substring($currentDate,9,2))"/>
            <xsl:variable name="secondDate" select="concat(substring(., 1,4),substring(., 6,2),substring(.,9,2))"/>
            <xsl:if test="$secondDate > $firstDate">
                <div class="event">
                    <div class="event_tout" id="event_tout{posisiton()}">
                        <script type="text/javascript">
                            pngpong.serveButtonPopup("event_tout{position()}", "images/vwe_tout3.png","images/vwe_tout3.png","http://www.dubwars.com/2007/index.htm","");
                        </script>
                    </div>
                    <div class="event_content">
                        <div class="event_header">
                            <div id="dub_wars" class="event_title text_blue"><a href="http://www.dubwars.com/2007/index.htm" target="_blank"><xsl:value-of select="./title" /></a></div>
                            <div class="event_location text_grey_dark"><xsl:value-of select="./location" /></div>
                        </div>
                        <div class="event_date text_grey_dark"><xsl:value-of select="." /></div>
                        <div class="event_body">
                            This is the only car show where you can take your V-dub in a closed course and drift, spin and burnout to your heart's content. They call it Hooliganism, we call it some of the most fun you can have in a VW.
                        </div>
                    </div>
                </div>
            </xsl:if>
        </xsl:for-each>
    </xsl:for-each>
[/code]

Thanks for that.. Here is a better example of what i'm trying to do..

i've replaced out some places with position() and {position()} etc.. Should this work?

Thank you.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Couple Errors on AddEditArticles page pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 December 14th, 2007 04:01 AM
Embedding HTML in data controls zoltac007 ASP.NET 2.0 Basics 3 May 24th, 2006 12:35 PM
New to XML. Have a couple basic questions sswingle XML 2 April 22nd, 2006 07:13 AM
A couple of questions: czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 March 23rd, 2005 03:13 PM
a couple of problems... please help! Spaceman Spiff Access 6 March 24th, 2004 12:23 PM





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