[Home] [By Thread] [By Date] [Recent Entries]
Vaduvoiu Tiberiu wrote:
I wonder what you mean with "display" as XSLT is a transformation language and cannot display anything. From what you read above I got the faint impression that you think you can build an element during transformation (level1/name) and then transform that same element again and request the value of that attribute. Also, you seem to think that you can have any multitude of attributes with the same name on an element (you use xsl:for-each) which is not possible because it is not XML. You create an attribute like this: <xsl:attribute name="bla">value</xsl:attribute> but it must be a direct child of an element, like this: <lre-element> <xsl:attribute name="bla">value</xsl:attribute> </lre-element> if the value is literate, you don't need to use xsl:attribute <lre-element bla="value" /> if the value can be expressed with an xpath expression (as opposed to, say, apply-templates or another for-each), you can use an AVT: <lre-element bla="{path/to/value}" /> Because it seems likely that you have not yet understood the XSLT processing model, or the basic ideas behind it, consider reading a tutorial. There are plenty on the web and I can recommend the books of Jeni Tenison fo starters and Michael Kay's for reference. Good luck coding -- Abel Braaksma PS: your original inquiry seems to be about enhancing existing XML with a couple attributes. Look up the modified copy template which will look something like the following in your case:
<xsl:template match="name">
<xsl:copy>
<xsl:attribute name="test">4</xsl:attribute>
<xsl:apply-templates select="node() | @*" /
</xsl:copy>
</xsl:template>
|

Cart



