Re: State diagrame with code export

Hi, thanks for your help.
I call some templates by name because this template looks for something in the whole file (by scanning all elements). This is the only one called by name, others are called with "match", as you said in your mail.

But, i 've juste solved my problem with an other mail from the mailing list (Using the XSLT plugin)
My probleme was to integrate my xsl file in stylesheets.xml. I've followed what it was written and it works ! (except that in the made file, xsl transformation has written all markup in one line, strange ...)

2009/4/24 Maciej Jaros <egil wp pl>
david wrote:
Hi, Steffen
Thanks for your answer and for the xsltproc link.

I' ve seen the differencies between my file and dia-uml2cpp.xsl. but I think's its ok because :
<xsl:output method="text"/>   <-  output file (it's xml for me)

I don't use thes parameters :
<xsl:param name="directory"/>
<xsl:param name="indentation"><xsl:text>  </xsl:text></xsl:param>

<xsl:template match="dia-uml">
The dia file what I want convert does'nt contain the "dia-uml" markup

I've tried to add the xsl namespace and to remove dia: prefixes but without changes...
This is the beginning of my file (with one template, if it works for this one, it works for all !) :
The file's header looks OK, but templates look strange. Typically if you want a template that parses some element you use one element in its match attribute. If you want to apply some specific template you call it by name.

Here is an example (a part of a bigger XSL)
<xsl:template match="tr">
        <xsl:apply-templates />
<xsl:template match="td">
    <td class="{ class}" colspan="{ colspan}">
        <xsl:apply-templates />

Note that when you use <xsl:apply-templates /> you will tell XSL engine to parse all sub nodes (including text nodes) and so in above example any <tr> would be parsed as is (but without attributes), if there would be <td> inside it would be parsed and any elements inside <td> would be omitted, but text nodes which by default are outputted as is. So e.g from this:
<tr style="color:blue">
 <td style="color:blue">
You will get:

Of course in above example your <xsl:template match="/"> would have to include some kind of <xsl:apply-templates ... />. And note again that you shouldn't use "//" in match attribute of templates - it matches any elements any way. Using my example again from this:
 <td class="test" style="display:inline">not in a row</td>
 <blah><td>cell in something else</td></blah>
You will get this:
 <td class="test">not in a row</td>
 <td>cell in something else</td>

Note that all <td> elements got parsed. But if in <xsl:template match="/"> you would have <xsl:template match="//tr"> you would only get:

(in reality you would get empty class and colspan attributes in output, but I've omitted this for clarity)


dia-list mailing list
dia-list gnome org
FAQ at
Main page at

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]