Re: State diagrame with code export



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 !) :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dia="http://www.lysator.liu.se/~alla/dia/"
  version="1.0">
  <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>

  <xsl:template match="/">
    <xsl:element name="scxml">
      <xsl:apply-templates select="//dia:object[ type='UML - State Term']"/>
      </xsl:element>
  </xsl:template>

  <xsl:template match="//dia:object[ type='UML - State Term'] ">
    <xsl:choose>
      <xsl:when test="dia:attribute[ name='is_final']/dia:boolean[ val='true']">
        <xsl:element name="final">
          <xsl:attribute name="id"><xsl:value-of select="concat('fin_',@id)"/></xsl:attribute>
        </xsl:element>
      </xsl:when>
      <xsl:otherwise>
        <xsl:element name="state">
          <xsl:attribute name="id">initial</xsl:attribute>
          <xsl:apply-templates select="//dia:object[ type='UML - Transition'] ">                   <xsl:with-param name="idEtatCourant" select="@id"/>
          </xsl:apply-templates>
        </xsl:element>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

Regards, David

2009/4/21 Steffen Macke <sdteffen gmail com>
Hi David,

thanks for sharing the code. If you look e.g. at dia-uml2cpp.xsl, which is part
of the Dia distribution, you'll notice a number of differences
compared to your code
(I've removed comments):

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
       <xsl:output method="text"/>
       <xsl:param name="directory"/>
       <xsl:param name="indentation"><xsl:text>  </xsl:text></xsl:param>

       <xsl:template match="dia-uml">

In case the snippet you provided was incomplete, please provide the
complete file(s).
Some hints:

* Provide the xsl namespace.
* omit the "dia:" prefix

Did you try debugging using xsltproc?
Maybe the Visual xsltproc debugger can help you:

http://sourceforge.net/projects/visual-xsltproc/

Regards,

Steffen

>  <xsl:template match="/">
>     <xsl:element name="dia-uml">
>       <xsl:apply-templates select="dia:object[ type='UML - State']"/>
>     </xsl:element>
>   </xsl:template>
>
>   <xsl:template match="dia:object[ type='UML - State']">
>     <xsl:element name="etat">
>     </xsl:element>
>   </xsl:template>
_______________________________________________
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]