472,119 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 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 1264
> 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jyrki Keisala | last post: by
5 posts views Thread by Fred | last post: by
reply views Thread by Terry Brown | last post: by
reply views Thread by Max Evans | last post: by
2 posts views Thread by Steveino | last post: by

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.