Jump to content

lknight

Members
  • Posts

    2
  • Joined

  • Last visited

lknight's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Oh, how simple. XSLT has the xsl:attribute function to set attributes. Problem solved: <div class="item"><xsl:attribute name="id">i<xsl:value-of select="@id"/></xsl:attribute><xsl:apply-templates select="@id"/><xsl:apply-templates select="content"/></div>
  2. I want to to some CSS formating based on individual xml item id's. Therefore, I need XSLT to convert the xml id attribute to an html if attribute. XML: <data><item id="0"><content>bla</content></item><item id="1"><content>bla</content></item></data> XSLT: <div id="<xsl:value-of select='@id'>"> <!-- Problem line --> <xsl:apply-templates select="@id"/> <xsl:apply-templates select="content"/></div> Of course a value-of within a <div> is invalid. I tried using > and <, but to no effect. Is there any way (apart from external scripts) to put the value of my xml id attribute into the html id attribute?I'm also open to another approach if anyone has one...
×
×
  • Create New...