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 February 16th, 2007, 09:28 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to give attribute value dynamically

in my xslt i am genarating
 <div>..in a loop and i want to give each div a unique id
 .like this...

 <div id = node01>
 <div id = node03>
 <div id = node04>
 node will be common the the value
how to do that...mens in my xsl what will be the expression pls give a example.. thnx
 
Old February 16th, 2007, 09:33 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Without seeing the XSLT it's hard to be exact but you need something like:
Code:
<xsl:for-each....

  <div id="node{position()}"/>
If you need all the IDs the same length you'll need some string manipulation as well.

--

Joe (Microsoft MVP - XML)
 
Old February 16th, 2007, 09:36 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

I believe you can use the generate-id function.


 
Old February 16th, 2007, 09:40 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<xsl:for-each select="Module/FormModule/Window">
            <div id= here id need dynamic id ( example like treeNoded0e66) style="display:none"><table border="0" cellspacing="0" cellpadding="0"><tr><td><img class="hiericon" src="images/blank.png"/><img class="hiericon" src="images/blank.png"/><img class="hiericon" src="images/blank.png"/><img class="hiericon" src="images/L.png"/></td><td valign="middle" onclick="whenNodeSelected(this)"><img class="icon" style="cursor:pointer" src="images/Window.png"/></td><td valign="middle" class="nodeitem" onclick="whenNodeSelected(this)">
            <xsl:value-of select="@Name"/>
               </td></tr></table>
               <div id="number part of same id i have to refer here with some string like nodePropertiesd0e66" style="display:none"><table border="0" cellspacing="0" cellpadding="1" width="100%">
                   <tr class="toolbar" height="20"><td class="nodevalue" colspan="2">
                       Window: <xsl:value-of select="@Name"/>
                   </td></tr>
                   <xsl:for-each select="@*">
                       <tr height="22"><td class="nodeprop">
                       <xsl:value-of select="name()"/>
                       </td><td class="nodevalue"></td></tr>
                      <xsl:value-of select="."/>
                </xsl:for-each>


               </table>
               </div>
               </div>
        </xsl:for-each>
 
Old February 16th, 2007, 09:41 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i'm very novice to xslt....i need each id with my predefine sting like nodes+some no...and how to use with code give exmple pls
 
Old February 16th, 2007, 09:54 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

So you just do as I suggested:
Code:
<div id="treeNode{position()}" style="display:none">
and
Code:
<div id="nodeProperties{position()}" style="display:none">
--

Joe (Microsoft MVP - XML)
 
Old February 17th, 2007, 05:00 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thnx buddy!!!! it's helping me lots





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
please give me a help wujilin SQL Language 2 May 28th, 2007 07:52 AM
How to give the value to a where - between san22 Pro VB.NET 2002/2003 1 May 5th, 2006 11:55 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
Dynamically set selected attribute fs22 Javascript How-To 5 December 24th, 2004 04:10 PM





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