Pass a XSL id to a CSS id tag: far fetched idea?
This is an open discussion with 6 replies, filed under General.
Search
Of course that’s possible. :-)
<xsl:template match="copy/entry"> <div id="{@id}"> ... </div> </xsl:template>
If you need more advanced logic in your id
attribute you can also use <xsl:attribute name="id" />
.
And you should remember that HTML ids cannot start with a number.
Excellent! Thanks!
@lbradford - if you don’t mind me asking, what are you trying to build?
(slightly off-topic)
@Makenosound that’s not entirely correct: HTML5 allows ID’s to start with a number (and a whole lot more). We’ve been able do it for a long time (browsers handle it just fine) but in HTML5 it is actually valid.
Still, I would not advocate starting with a number because you would have to escape the rule in CSS but it works fine.
@bzerangue - It’s just a super simple navigation/’Contents’ to make it easier to get through a long list of content.
Create an account or sign in to comment.
This may be crazy, but I am wondering if there’s a way to dynamically name CSS id’s.
For instance, if this is my XSL output:
could I select, say, the entry id, and pass it (somehow using a fancy x-path) into the CSS id so it outputs like so:
Probably not possible, but just wondering.