469,643 Members | 1,698 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

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 1188
> 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
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.