473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

choose and Attribute Value Templates { }

Hi!

I'm creating dynamic a XML file. in this file are store some
informations about images i use in HTML datasheets. i'm going to
transform the XML file with XSLT.
My Problem is, that {image} allways select ths first attribute in
<images>, ingnoring the type of image (the types are 0, 10, 20 or 30).
Perhaps, somebody is able to help me with my problem!?!

Here is the important part of my XML File:
################################################## ####################
<images>
<image type="10">D:\Projects\CNC Navigator\CNC
Navigator\datasheets\OSV15000C.gif</image>
<image type="20">D:\Projects\CNC Navigator\CNC
Navigator\datasheets\CSV15000C_2.gif</image>
</images>
################################################## ####################


In my XSLT i'm going to create two tables with the pictures...here is
the first one...:
################################################## ####################
<table width="100%">
<tr class="tableHeader">
<td>Motor Characteristics</td>
</tr>
<xsl:for-each select="clsServomotor/images">
<xsl:choose>
<xsl:when test="image/@type=20">
<tr>
<td>
<a href="{image}" target="_blank">
<img src="{image}" width="700" />
</a>
</td>
</tr>
</xsl:when>
<xsl:when test="image/@type=30">
<tr>
<td>
<a href="{image}" target="_blank">
<img src="{image}" width="700" />
</a>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
################################################## ####################

and the second table...:
################################################## ####################
<table width="100%">
<tr class="tableHeader">
<td>Outline Dimensions</td>
</tr>
<xsl:for-each select="clsServomotor/images">
<xsl:choose>
<xsl:when test="image/@type=10">
<tr>
<td>
<a href="{image}" target="_blank">
<img src="{image}" width="700" />
</a>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
################################################## ####################
Many Thanks!

Greetings, DaBoo
Jul 20 '05 #1
1 1765
In article <43**************************@posting.google.com >,
DaBoo <Fl************@gefanuceur.ge.com> wrote:

% My Problem is, that {image} allways select ths first attribute in
% <images>, ingnoring the type of image (the types are 0, 10, 20 or 30).
% Perhaps, somebody is able to help me with my problem!?!

Actually, {image} always selects the text content of the first image
element (and all its children, but it doesn't have any children in
this case). You need to use a different XPath expression in the for-each
loop to get the effect you want. Try

<xsl:for-each select="clsServomotor/images/image">
<xsl:choose>
<xsl:when test="@type=20">
<tr>
<td>
<a href="{.}" target="_blank">
<img src="{.}" width="700" />
</a>
</td>
</tr>
</xsl:when>
<xsl:when test="@type=30">
<tr>
<td>
<a href="{.}" target="_blank">
<img src="{.}" width="700" />
</a>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Zhou Lei | last post by:
Hello now I'm writing the XSL to transform the XML to an html file, and some xml elements are: <user login="loginname"> <name>James Cook</name> </user> I need to include the login attribute...
2
by: Keith Chadwick | last post by:
Is there a way to append to an attribute in XSLT. For example: <input name="emailaddress" style="width:200px"> <xsl:apply-templates select="//object"/> </input> <xsl:template...
8
by: patrizio.trinchini | last post by:
Hi All, I'would like to write an XSL transformation that changes the value of the atribute of a given element according to the value of another atttribute of the same element. For instance,...
3
by: patrizio.trinchini | last post by:
Hi, how can remove sibling elements based on the value of an attribute ? For instance, gven the XML document: <root> <parentElment> <testElement name="A"> <removableElement/>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.