Re: State diagrame with code export
- From: david <daav14 gmail com>
- To: discussions about usage and development of dia <dia-list gnome org>
- Subject: Re: State diagrame with code export
- Date: Fri, 24 Apr 2009 09:38:45 +0200
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">
<tr>
<xsl:apply-templates />
</tr>
</xsl:template>
<xsl:template match="td">
<td class="{ class}" colspan="{ colspan}">
<xsl:apply-templates />
</td>
</xsl:template>
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">
<b>ab<i>c</i></b>
</td>
</tr>
You will get:
<tr>
<td>
abc
</td>
</tr>
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:
<tr><td>test</td></tr>
<td class="test" style="display:inline">not in a row</td>
<blah><td>cell in something else</td></blah>
You will get this:
<tr><td>test</td></tr>
<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:
<tr><td>test</td></tr>
(in reality you would get empty class and colspan attributes in output,
but I've omitted this for clarity)
Regards,
Nux.
_______________________________________________
dia-list mailing list
dia-list gnome org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]