473,387 Members | 1,464 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,387 software developers and data experts.

Using elements inside XSLT file

I have a XML file, which contains itemid-elements, e.g.:
<itemid>3</itemid>
<itemid>12</itemid>
Now I want to convert these IDs to the corresponding name via XSLT. I
thought I could do it this way (XSLT):
<xsl:apply-templates select="itemid" />
<xsl:template match="itemid">
<xsl:value-of select="itemnames[itemid]" />
</xsl:template>
And I'd like to have this itemnames-element also inside the XSLT file
(rather than another XML file):
<itemnames>
<item>chair</item>
<item>table</item>
<item>cupboard</item>
...
</itemnames>

But it doesn't work this way because the XSLT processor searches the XML
file for the itemnames-element but it is inside the XSLT file. Is it
possible to point to the itemnames-element inside of the XSLT file? How?

Thank you in advance!
(Sorry, if this message is shown twice, I accidentally used the wrong
news server at first.)

May 26 '06 #1
1 1334
> possible to point to the itemnames-element inside of the XSLT file? How?

The document() function, when called with no arguments, refers to the
stylesheet document.
May 26 '06 #2

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

Similar topics

3
by: Edwin G. Castro | last post by:
Hi, I'm new to XSLT and I'm having a hard time figuring out whether XSLT will do what I need it to do. I have a XML file with a whole bunch of <message> elements. These <message> elements...
5
by: Jyrki Keisala | last post by:
Hi, I am trying to transform an XML file into a HTML table with XSLT. The structure of my XML file is roughly this: <profile> <command name="..." phrase="..."> <key extended="..."...
5
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
6
by: Mark Miller | last post by:
I have a scheduled job that uses different XSL templates to transform XML and save it to disk. I am having problems with the code below. The problem shows up on both my development machine (Windows...
0
by: Terry Brown | last post by:
I have an xml file: <?xml version="1.0" encoding="utf-8" ?> <G2Registers xmlns="http://tempuri.org/registers.xsd"> <register> <name>Version Register</name> <address>"00000000"</address>...
6
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on small XML files but generates OutOfMemory...
0
by: Max Evans | last post by:
I have a XML file, which contains itemid-elements, e.g.: <itemid>3</itemid> <itemid>12</itemid> Now I want to convert these IDs to the corresponding name via XSLT. I thought I could do it this...
2
by: Steveino | last post by:
Hello, Just wondering if anyone could shed any light on this, it's probably me just being silly... I have a dataset that I've used to create an XmlDataDocument, in order to apply XSL. The XSL...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.