Xml Xls ed Excel per la produzione espressa di Html - Chiara Bettaglio

  • 1,077 views
Uploaded on

Presentazione alla Girl Geek Dinner #12 di Milano, una serata dedicata all'How to in formato Ignite …

Presentazione alla Girl Geek Dinner #12 di Milano, una serata dedicata all'How to in formato Ignite

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,077
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. di Chiara Bettaglio RS Component GGD #12 – 14 maggio 2010 Xml Xls ed Excel per la produzione espressa di Html
  • 2. PRIMA CONTENUTI DESIGN Produzione REVIEW CORREZIONI PUBLISH
  • 3. ORA DESIGN CONTENUTI E CORREZIONE PUBLISH
  • 4. I miei files! Uno script DOS Un file Excel Una cartella con Fogli di stile XSL e database Dei contenuti XML
  • 5. I miei files! Un motore per processare l’XSLT I fogli di stile XSLT I miei contenuti in XML Un file per le istruzioni
  • 6. XML
    • Mini database di informazioni
    XSLT Foglio di stile per XML
  • 7. XSLT processor
    • Xalan/Xerces (Java, open source)
    • Saxon (Java, open source)
    • Altova XSLT Engine (C++, gratis)
    • MS XML (C++, gratis)
    <XML> <XSLT> XALAN <HTML>
  • 8. xHTML
    • I tag devono essere sempre chiusi
    • Nomi degli attributi in minuscolo
    • Valori degli attributi tra virgolette
    • Minimizzare gli attributi è proibito
    • Si usa l’ ID invece che l’attributo name
    • Il DTD XHTML definisce alcuni elementi obbligatori
    <td WIDTH=100% nowrap><br> <td width=&quot;100%&quot; nowrap=“nowrap&quot;> <br/> <image src =“img.gif“ alt=“ola!“/>
  • 9. Individuo il mio contenuto Testi links Valuta! Path immagini! anche quello nascosto!!
  • 10. Creo un master XML con il mio contenuto
    • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
    • <page>
    • <store></store>
    • <campaignID></campaignID>
    • <spare1></spare1>
    • <spare2></spare2>
    • <title></title>
    • <container>
    • <box>
    • <image1></image1>
    • <image2></image2>
    • <linkText></linkText>
    • <linkTextURL></linkTextURL>
    • <text></text>
    • </box>
    • <box>
    • <image1></image1>
    • <image2></image2>
    • <linkText></linkText>
    • <linkTextURL></linkTextURL>
    • <text></text>
    • </box>
    • </container>
    • </page>
    Elementi ricorrenti } Parametri come valuta, Nome campagna e il mercato di vendita Eventuali testi, immagini, valori per attributi css
  • 11. Da XML a Excel Creo un file come fosse una maschera di inserimento dati per gli elementi che ho individuato in XML Comprende etichette e valori in inglese che i vari mercati dovranno tradurre localmente
  • 12. Mappo l’XML in Excel
  • 13. Tasto export + macro Private Sub Pulsante_Clic() ActiveWorkbook.XmlMaps(&quot;page_mapping&quot;).Export URL:= ThisWorkbook.Path & &quot;in emplate.xml&quot;, Overwrite:=True End Sub
  • 14. xHTML to XSL
    • <table width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
    • <tr><td class=&quot;header&quot;> <xsl:value-of select=&quot;page/homePage/LEDSlamp&quot;/> </td></tr>
    • <tr><td class=&quot;content&quot; style=&quot;padding:6px;&quot;>
    • <img src=&quot;/ {$store} /img/site/campaigns/ {$cp} / {page/homePage/LEDSlampImg} &quot; align=&quot;right&quot;/>
    • <xsl:value-of select=&quot;page/homePage/LEDSlampTxt&quot; disable-output-escaping=&quot;yes&quot;/> <br/>
    • <a href=&quot;{page/homePage/LEDSlampLink}&quot;>
    • <strong><xsl:value-of select=&quot;page/homePage/LEDSlampLinkTXT&quot;/></strong></a> </td></tr></table>
  • 15. xHTML to XSL
    • <xsl:for-each select=&quot;page/homePage/featuredProds/box&quot;>
    • …………………………………… .
    • </xsl:for-each>
    • <xsl:if test=&quot;CurrencyPosition = 'after'&quot;>
    • &nbsp;<xsl:value-of select=&quot;$currency&quot; disable-output-escaping=&quot;no&quot;/>
    • </xsl:if>
  • 16. Anche file di testo semplici!
    • title= <xsl:value-of select=&quot;page/homePage/campaignTitle&quot; />&cr;
    • description= <xsl:value-of select=&quot;page/homePage/blurb&quot; /> &cr;
    • keywords= < xsl:for-each select=&quot;page/seo/keywords &quot;>
    • <xsl:value-of select=&quot;linkText&quot;/>,
    • </xsl:for-each>&cr;
    • header=Y &cr;
    • footer=Y &cr;
    • file:stylesheet=style.css &cr;
  • 17. Il batch…
    • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
    • <!DOCTYPE xsl:stylesheet [
    • <!ENTITY nbsp &quot;&#160;&quot;>
    • <!ENTITY copy &quot;&#169;&quot;>
    • <!ENTITY reg &quot;&#174;&quot;>
    • <!ENTITY trade &quot;&#8482;&quot;>
    • <!ENTITY mdash &quot;&#8212;&quot;>
    • <!ENTITY ldquo &quot;&#8220;&quot;>
    • <!ENTITY rdquo &quot;&#8221;&quot;>
    • <!ENTITY pound &quot;&#163;&quot;>
    • <!ENTITY yen &quot;&#165;&quot;>
    • <!ENTITY cr &quot;<xsl:text>
    • </xsl:text>&quot;>
    • ]>
    • <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;>
    • <xsl:output method=&quot;text&quot; encoding=&quot;utf-8&quot;/>
    • <xsl:template match=&quot;/&quot;>
    • ………………………………………………………………………………………………………………………………………………………… .
    • </xsl:template>
    • </xsl:stylesheet>
  • 18. … con le istruzioni
    • java -classpath binxalan.jar;binserialiser.jar org.apache.xalan.xslt.Process -IN bin emplate. xml -XSL binhome. xsl -OUT home.html &cr;
    • java -classpath binxalan.jar;binserialiser.jar org.apache.xalan.xslt.Process -IN bin emplate.xml -XSL bincp.xsl -OUT campaign.txt &cr;
    • java -classpath binxalan.jar;binserialiser.jar org.apache.xalan.xslt.Process -IN bin emplate.xml -XSL bin ext.xsl -OUT load.bat &cr;
  • 19. Non solo html… ad esempio… il load!
    • &#62;&#62;script.ftp ECHO USERNAME &cr;
    • &#62;&#62;script.ftp ECHO PASSWORD &cr;
    • &#62;&#62;script.ftp ECHO ascii &cr;
    • &#62;&#62;script.ftp ECHO CD BASE PATH DI CARICAMENTO &cr;
    • &#62;&#62;script.ftp ECHO mkdir <xsl:value-of select=&quot;page/campaignName&quot;/> &cr;
    • &#62;&#62;script.ftp ECHO CD BASE PATH DI CARICAMENTO &#47;<xsl:value-of select=&quot;page/campaignName&quot;/>&#47;&cr;
    • FOR &#37;&#37;f in (&#42;.html, &#42;.txt, &#42;.css)
    • do &#62;&#62;script.ftp ECHO put &#37;&#37;f&cr;
    • &#62;&#62;script.ftp ECHO bye&cr;
    • FTP -v -s:script.ftp INDIRIZZO FTP SERVER &cr;
    • DEL script.ftp&cr;
    • REM DEL &#42;.html &cr;
    • REM DEL &#42;.txt &cr;
    • GOTO End &cr;
    • :End &cr;
    • start iexplore http://MIOSITO.COM
  • 20. Il Clickme.bat
    • java -classpath binxalan.jar;binserialiser.jar org.apache.xalan.xslt.Process -IN bin emplate.xml -XSL binatch.xsl -OUT doAll.bat
    • call doAll.bat
    • call load.bat
    • del doAll.bat
    • del load.bat
    • del *.html
    • del *.txt
  • 21. Distribuzione alle opco Inserimento Contenuti localizzati Preview / Correzione in Excel Rerun del Template