xsl-list
[Top] [All Lists]

Re: [xsl] Select attribute using a variable

2008-01-23 03:19:06
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Abel Braaksma wrote:
You cannot do it like this, as XSLTProc is saying: it is a syntax error
(after the double colon should be a node name (QName) not a variable
name). Instead, if you want to check the name of an attribute and then
select that attribute, try this:

select="/document/styles/style[(_at_)name=$style_name]/@*[name() = $property]"

This is working like a charm, thanks for the quick answer!

If there are more <style> nodes with an attribute "name" with the value
of $style_name, this may return more than one attribute, depending on
the XSLT version. If you need to do something for each <style>, use
templates instead of an absolute XPath.

Each "name" attribute of <style> is unique so this is not a problem.

regards,
strawks
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHlxR9+2TXLlA5m78RAvhYAJ9kGh8uC2/njfuHom4Gcs58t5wONACcDpxA
OT/p5LR+kUVyPp4dvHSwFQM=
=lwFO
-----END PGP SIGNATURE-----

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>