Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:miw08_xtt_xml [2008/03/18 16:22]
gjn
pl:miw:miw08_xtt_xml [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 ====== Opis ====== ====== Opis ======
 +__**Projekt zakończony**__
 +
 +
 Szymon Deja <​szydej@gmail.com>​ Szymon Deja <​szydej@gmail.com>​
  
Linia 15: Linia 18:
  
 ===== 080318 ===== ===== 080318 =====
-  * próba translacji [[student:​xttml20|XTTML20]] do graphviza+  * próba translacji [[hekatedev:​hqed:​xttml20|XTTML20]] do graphviza 
  
 ===== 080401 ===== ===== 080401 =====
   * syntetyczny opis ograniczeń podejścia xttml->​gv (czego i dlaczego nie da się zrobić)   * syntetyczny opis ograniczeń podejścia xttml->​gv (czego i dlaczego nie da się zrobić)
   * próba zrobienia tego w [[http://​www.w3.org/​Graphics/​SVG/​|SVG]] patrz FIXME proj z miw z zeszlego roku   * próba zrobienia tego w [[http://​www.w3.org/​Graphics/​SVG/​|SVG]] patrz FIXME proj z miw z zeszlego roku
 +
 +
 +
 +===== 080408 =====
 +  * co jest nie tak?
 +  * [[http://​xml.apache.org/​xalan/​|xalan]]
 +
 +===== 080415 =====
 +  * jw
 +
 +===== 080429 =====
 +  * [[hekate:​hekate_markup_language#​xttml]]
 +
 +===== 080527 =====
 +  * przykłady xttml
 +  * sprawozd
  
 ====== Projekt ====== ====== Projekt ======
Linia 44: Linia 64:
   * Translacja dotml do grapviza (dot) {{:​pl:​miw:​dotml2dot.txt|dotml2dot.xsl}}   * Translacja dotml do grapviza (dot) {{:​pl:​miw:​dotml2dot.txt|dotml2dot.xsl}}
   * Translacja ​ XTTML20 do dotml (XSLT) ​ {{:​pl:​miw:​xtt2dot.txt|xtt2dotml.xsl}}   * Translacja ​ XTTML20 do dotml (XSLT) ​ {{:​pl:​miw:​xtt2dot.txt|xtt2dotml.xsl}}
 +
 +
  
 <code xml> <code xml>
Linia 160: Linia 182:
  
  
 +===== 080401 =====
  
 +xttml -> svg (XSL)  {{:​pl:​miw:​xttml2svg2.xml|xttml2svg.xsl}}
  
  
  
 +<code xml>
 +<​xsl:​stylesheet version="​1.0"​ xmlns:​xsl="​http://​www.w3.org/​1999/​XSL/​Transform"​ xmlns="​http://​www.w3.org/​2000/​svg"​ xmlns:fn ="​http://​www.w3.org/​2005/​02/​xpath-functions">​
 +    ​
 +    <​xsl:​variable name="​temp"​ />
 +    <​xsl:​output method="​xml"​ indent="​yes"​ omit-xml-declaration="​no"​ />
 +    ​
 +    <​xsl:​template match="/">​
 +        <svg
 +            xmlns="​http://​www.w3.org/​2000/​svg"​
 +            version="​1.0"​
 +            width="​297mm"​
 +            height="​420mm"​
 +            id="​svg2">​
 +            <​xsl:​apply-templates select="/​xttml/​xtt_list_table/​xtt_table"​ />
 +            <​xsl:​apply-templates select="/​xttml/​xtt_list_connections/​xtt_connection"​ />
 +        </​svg>​
 +    </​xsl:​template>​
 +   
 +    <​xsl:​template match="//​xtt_table">​
  
 +        <​xsl:​variable name="​xpos"​ select="​ ./​localization/​@xpos ​  "/> ​
 +        <​xsl:​variable name="​ypos"​ select="​./​localization/​@ypos "/> ​
  
 +     
 +          <​xsl:​variable name="​header"​ select="​./​localization/​@header_height "/> ​
  
 +        <​xsl:​for-each select="​column_attributes/​ca">​
 +            <​xsl:​variable name="​col"​ select="​position()"/>​
 +            <​xsl:​variable name="​x"​ select="​ $xpos + sum(../​../​localization/​col_widths/​cw[ position() &lt; $col])"/> ​
 +            <​xsl:​variable name="​y"​ select="​ $ypos"/> ​
 +            <​xsl:​variable name="​xdl"​ select="​../​../​localization/​col_widths/​cw[$col]"/> ​
  
 +            <rect x="​{$x}"​ y="{$y -$header}"​ width="​{$xdl}"​ height="​{$header}"​
 +                style="​fill:​none;​stroke:#​0080c0;"/>​
 +            ​
 +            <​text ​ x="​{$x}"​ y="​{$y} "
 +                style="​font-size:​10pt;​font-weight:​bold;​text-anchor:​start;​font-family:​Courier New;">​
 +                <​xsl:​value-of select="​."/></​text>​
 +            ​
 +        </​xsl:​for-each>​
 +                <​xsl:​for-each select="​row">​
 +                    <​xsl:​variable name="​row"​ select="​position()"/>​
 +              ​
 +                    <​xsl:​for-each select="​cell">​
 +                        <​xsl:​variable name="​col"​ select="​position()"/>​
 +                ​
 +                        <​xsl:​variable name="​x"​ select="​ $xpos + sum(../​../​localization/​col_widths/​cw[ position() &lt; $col])"/> ​
 +                        <​xsl:​variable name="​y"​ select="​ $ypos +$header+ sum(../​../​localization/​nrow_heights/​rh[ position() &lt; $row])"/> ​
 +                        <​xsl:​variable name="​xdl"​ select="​../​../​localization/​col_widths/​cw[$col]"/> ​
 +                        <​xsl:​variable name="​ydl"​ select="​../​../​localization/​nrow_heights/​rh[$row]"/> ​
 +                    ​
 +                        <rect x="​{$x}"​ y="{$y -$ydl}"​ width="​{$xdl}"​ height="​{$ydl}"​
 +                            style="​fill:​none;​stroke:#​0080c0;"/>​
 +                        ​
 +                        <​text ​ x="​{$x}"​ y="​{$y} "
 +                            style="​font-size:​10pt;​font-weight:​normal;​text-anchor:​start;​font-family:​Courier New;">​
 +                            <​xsl:​choose>​
 +                                <​xsl:​when test="​./​@operator='​e'">​
 +                                    <​xsl:​text>​=</​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​ne'">​
 +                                    <​xsl:​text>​!=</​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​g'">​
 +                                    <​xsl:​text>&​gt;</​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​ge'">​
 +                                    <​xsl:​text>&​gt;​=</​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​l'">​
 +                                    <​xsl:​text>​ &lt; </​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​le'">​
 +                                    <​xsl:​text>​ &lt;= </​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​min'">​
 +                                    <​xsl:​text>​ min </​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​when test="​./​@operator='​in'">​
 +                                    <​xsl:​text>​ in </​xsl:​text>​
 +                                </​xsl:​when>​
 +                                ​
 +                            </​xsl:​choose>​
 +                            <​xsl:​text>​ </​xsl:​text>​
 +                            <​xsl:​value-of select="​@content"/></​text>​
 +                    ​
 +                  ​
 +                    </​xsl:​for-each>​
 +                </​xsl:​for-each> ​         ​
 +    </​xsl:​template>​
 + 
 + 
 +    <​xsl:​template match="//​xtt_connection">​
 +        ​
 +        <​xsl:​variable name="​pozycja"​ select="​ position() ​ "/> ​
 +        <​xsl:​variable name="​ile"​ select="​ last() ​ "/> ​
 +        ​
 +        <​xsl:​variable name="​stab"​ select="​@source_table_name"/> ​
 +        <​xsl:​variable name="​dtab"​ select="​@destination_table_name"/> ​
 +        <​xsl:​variable name="​srow"​ select="​@source_row +1 "/> ​
 +        <​xsl:​variable name="​drow"​ select="​@destination_row ​ +1"/> ​
 +       
  
 +        <​xsl:​variable name="​x1"​ select=" ​ /​xttml/​xtt_list_table/​xtt_table[@name = $stab]/​localization/​@xpos ​ + sum(/​xttml/​xtt_list_table/​xtt_table[@name = $stab]/​localization/​col_widths/​cw[ position() &lt; last()+1])"/>​
 +        <​xsl:​variable name="​y1"​ select="​ /​xttml/​xtt_list_table/​xtt_table[@name = $stab]/​localization/​@ypos ​ +/​xttml/​xtt_list_table/​xtt_table[@name = $stab]/​localization/​@header_height +
 +            sum(//​xtt_table[@name = $stab]/​localization/​nrow_heights/​rh[ position() &lt; $srow ]) -number( ( //​xtt_table[@name = $stab]/​localization/​nrow_heights/​rh[ $srow ])* 0.5)"/> ​
 +        ​
 +     
 +        <​xsl:​variable name="​x2"​ select="​ /​xttml/​xtt_list_table/​xtt_table[@name = $dtab]/​localization/​@xpos ​ "/>
 +        <​xsl:​variable name="​y2"​ select="​ /​xttml/​xtt_list_table/​xtt_table[@name = $dtab]/​localization/​@ypos ​ +/​xttml/​xtt_list_table/​xtt_table[@name = $dtab]/​localization/​@header_height +
 +            sum(//​xtt_table[@name = $dtab]/​localization/​nrow_heights/​rh[ position() &lt; $drow]) - number( //​xtt_table[@name = $dtab]/​localization/​nrow_heights/​rh[ $drow] *0.5)"/> ​
 +        ​
 +        <​xsl:​variable name="​x"​ select="​number((($x2 - $x1) div ($ile + 1)) *($pozycja) +$x1 )"/>​
 +        <​xsl:​variable name="​y"​ select="​ last() ​ "/> ​
 +        ​
 +        <​polyline points="​{$x1},​{$y1},​{$x2},​{$y2}"​
 +        style="​fill:​white;​stroke:​red;​stroke-width:​1"/>​
  
 +    </​xsl:​template>​
 + 
  
 +    ​
 +</​xsl:​stylesheet>​
  
  
 +</​code>​
  
  
 +
 +
 +
 +
 +
 +
 +===== svg =====
 +Plik wejsciowy {{:​pl:​miw:​thermostat2.0.xml|:​pl:​miw:​thermostat2.0.xml}}
 +
 +przykladowy wynik translatora {{:​pl:​miw:​termostat2.svg|termostat.svg}}
 +
 +
 +
 +{{:​pl:​miw:​termostat.jpg|{{:​pl:​miw:​prolog_javasockets_v.1.jpg|:​pl:​miw:​prolog_javasockets_v.1.jpg}}}}
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +===== xalan =====
 +
 +   java org.apache.xalan.xslt.Process -in thermostat2.0.xml -xsl xttml2svg.xsl ​
 +
 +Firefox tez sobier radzi z tralnslacja pliku (musi byc dostepny plik xtt2svg.xsl) : {{pl:​miw:​thermostat2.0.xml|thermostat.xml}}
 +
 +Saxon
 +   java net.sf.saxon.Transform -s:source -xsl:​stylesheet -o:output
  
  
  
 ====== Sprawozdanie ====== ====== Sprawozdanie ======
 +Celem projektu było stworzenie tlanslatroa XSLT z formatu XTT do plików dot oraz SVG.
 +Niestety reprezentacja plików XTT nie prezentuje sie najlepiej w graphize. Ograniczenia jakie napotkałem podczas tworzenia plików dot są opisane poniżej:
  
  
  
 +===== xttml→gv =====
 +
 +Translacja ​ XTTML20 do graphviza ​
 +  * Translacja dotml do grapviza (dot) {{:​pl:​miw:​dotml2dot.txt|dotml2dot.xsl}}
 +  * Translacja ​ XTTML20 do dotml (XSLT) ​ {{:​pl:​miw:​xtt2dot.txt|xtt2dotml.xsl}}
 +
 +
 +Opis ograniczeń podejścia xttml→gv ​
 +  * Tekst w komurakch tabeli nie moze zawierać znaków : <, >, }, {
 +  * graviz nie radzi sobie z odpowiednim ustawieniem przy złożonych diagramach (źle rysuje polączenia miedzy tabelami)
 +
 +
 +
 +
 +
 +
 +
 +===== xttml→SVG =====
 +
 +Plik XSL: 
 +xttml -> svg (XSL)  {{:​pl:​miw:​xttml2svg2.xml|xttml2svg.xsl}}
 +
 +
 +Działanie translatora zostało przetestowane na poniższych silnikach XSLT:
 +Poniżej podano komendy wywołujące dany silnik.
 +
 +XALAN
 +   java org.apache.xalan.xslt.Process -in thermostat2.0.xml -xsl xttml2svg.xsl ​
 +
 +Saxon
 +   java net.sf.saxon.Transform -s:source -xsl:​stylesheet -o:output
 +
 +Przykładowy wynik działania translatora dla pliku termostat:
 +przykladowy wynik translatora {{:​pl:​miw:​termostat2.svg|termostat.svg}}
 +
 +
 +
 +{{:​pl:​miw:​termostat.jpg|{{:​pl:​miw:​prolog_javasockets_v.1.jpg|:​pl:​miw:​prolog_javasockets_v.1.jpg}}
  
  
Linia 220: Linia 435:
  
   * [[http://​www.ag-nbi.de/​research/​owltrans/​]]   * [[http://​www.ag-nbi.de/​research/​owltrans/​]]
 +
 +
 +[[http://​www.w3schools.com/​svg/​default.asp| SVG tutorial ]]
 +
  
pl/miw/miw08_xtt_xml.1205853771.txt.gz · ostatnio zmienione: 2019/06/27 15:58 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0