SlideShare a Scribd company logo
All About XSLT
4D デベロッパカンファレンス 2010
All About XSLT

• このセッションの内容
 ‣ XSLTの概要
 ‣ XSLTの利点
 ‣ XSLTと4D
 ‣ XSLTの作成, 編集, 検証
 ‣ XSLTの応用


                       Clichy/2010-02-03
XSLTの概要

• XMLを他の標準テキスト形式に変換するための言語




  XML       XSL      TEXT




                             Clichy/2010-02-03
XSLTの概要

• XMLを他の標準テキスト形式に変換するための言語




  XML       XSL      HTML
                     TEXT
                     XML
                      XSL




                             Clichy/2010-02-03
XSLTの利点

• XMLを変換するための標準の技術
• XMLを解析, 再構成, 統計, 並び替え, グループ...
    ✦xPathは強力なクエリ言語
• XMLのノードタイプすべてに対してアクセス...
    ✦コメントの出力OK=4D HTML TAGS !

                                   Clichy/2010-02-03
XSLTの利点
<region name="ヨーロッパ">
              ヨーロッパ
!   <country name="イギリス">
                   イギリス
!   !   <language name="英語">
                        英語
!   </country>
!                  フランス
    <country name="フランス">
!   !                   仏語
        <language name="仏語">
! </country>
</region>
<region name="アフリカ">
              アフリカ
!   <country name="カメルーン">
                   カメルーン
!   !   <language name="仏語" />
                        仏語
!   !   <language name="英語" />
                        英語
!   </country>
!   <country name="ガボン">
                   ガボン
!   !   <language name="仏語">
                        仏語
! </country>
</region>
                                 Clichy/2010-02-03
XSLTの利点
<language name="英語">
                英語
!   <region name="ヨーロッパ">
                  ヨーロッパ
!   !   <country name="イギリス"/>
                       イギリス
!   </region>
!   <region name="アフリカ">
                  アフリカ
!   !   <country name="カメルーン"/>
! </region>
</language>
<language name="仏語">
                仏語
!   <region name="ヨーロッパ">
!   !   <country name="フランス"/>
                       フランス
!   </region>
!   <region name="アフリカ">
!   !   <country name="ガボン"/>
                       ガボン
!   !   <country name="カメルーン"/>
                       カメルーン
! </region>
</language>
                                  Clichy/2010-02-03
XSLTの利点

<country name="イギリス" region="ヨーロッパ">
               イギリス          ヨーロッパ
!   !   <language name="英語"/>
</country>
<country name="ガボン" region="アフリカ">
               ガボン          アフリカ
!   !   <language name="仏語"/>
                        仏語
</country>
<country name="カメルーン" region="アフリカ">
               カメルーン
!   !   <language name="仏語"/>
!   !   <language name="英語"/>
</country>
<country name="フランス" region="ヨーロッパ">
               フランス
!   !   <language name="仏語"/>
</country>


                                       Clichy/2010-02-03
サンプル
XSLTの概要
XSLTの概要

• XML形式で記述するプログラム言語
 ‣ 実行前にXML妥当性検証, 解析, コンパイル
 ‣ 要素はコマンド
 ‣ 属性は命名引数
 ‣ 要素値は数が定まらない引数




                             Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>




                                      Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>


             コマンド
                                      Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>


         リテラルな出力
                                      Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>


               xPath
                                      Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>


                関数
                                      Clichy/2010-02-03
XSLTの概要
<xsl:template match=”/”>
<data>
 <xsl:for-each select=”//*[@id&gt;1]”>
  <month id=”{@id}”>
  <xsl:value-of select=”name($name)” />
  </month>
 </xsl:for-each>
</data>
</xsl:template>


             変数/引数
                                      Clichy/2010-02-03
XSLTと4D
XSLTと4D

• APPLY XSLT TRANSFORMATION
 ‣   Apache xalan-c
 ‣   XSLT 1.0
 ‣   BLOB; BLOB; BLOB
 ‣   path; path; path

• SET XSLT PARAMETER
 ‣ “12345”
 ‣ “‘abc’”


                              Clichy/2010-02-03
XSLTと4D

• APPLY XSLT TRANSFORMATION
 ‣   Apache xalan-c
 ‣   XSLT 1.0
 ‣   BLOB; BLOB; BLOB 一時ファイル必要なし
 ‣   path; path; path

• SET XSLT PARAMETER
 ‣ “12345”
 ‣ “‘abc’”


                                   Clichy/2010-02-03
XSLTと4D

• APPLY XSLT TRANSFORMATION
 ‣   Apache xalan-c
 ‣   XSLT 1.0
 ‣   BLOB; BLOB; BLOB 一時ファイル必要なし
 ‣   path; path; path コンパイルをキープ
• SET XSLT PARAMETERimport, include
 ‣ “12345”
 ‣ “‘abc’”            document(‘’)


                                      Clichy/2010-02-03
XSLT+SVG
微妙な関係!?

DOM      document

SAX          BLOB

XSLT     PICTURE

             TEXT




                    Clichy/2010-02-03
微妙な関係!?

DOM
document
   BLOB
   PICTURE
      TEXT

SAX

XSLT

             Clichy/2010-02-03
微妙な関係!?

DOM

 SAX          BLOB
document
           PICTURE

              TEXT


XSLT

                     Clichy/2010-02-03
微妙な関係!?

DOM

SAX

XSLT       PICTURE
document
              TEXT
   BLOB




                     Clichy/2010-02-03
微妙な関係!?
   TEXT              BLOB
    Regex

   DOM                XSLT
   SVG (get)
 SVG animatable
 PICTURE            document
SVG (own copy)
 SVG interactive
                      SAX
                               Clichy/2010-02-03
xPath
xPath
     • XMLコマンドはxPathサポートしている?
           ‣
         DOM Create XML element
 4DではElement[ElementNum]シンタックスを使用した添字によるXPath要素への

           ‣ DOM Find XML element
 アクセスも使用できます。例えば以下の構造があるとき:

           ‣ DOM
    <RootElement> SET XML VALUE
       <Elem1>
          <Elem2>aaa</Elem2>
     •      element[index]
          <Elem2>bbb</Elem2>
          <Elem2>ccc</Elem2>
      ‣       インデックスで要素が参照できるだけ。
       </Elem1>
    </RootElement>

      ‣ それ以外のxPathはNG。
 XPath記法では /RootElement/Elem1/Elem2[3] シンタックスを使用して"ccc"値
 にアクセスできます。



http://www.4d.com/docs/CMJ/CMJ10099.HTM
                                                      Clichy/2010-02-03
xPath

• /preceding-sibling::*                  軸


• /element/@attribute                    属性


• /*/@*                                ワイルドカード

• *[name()=‘table’ and @id=‘1’]        プレディケート

• *[matches(@uuid,(‘[0-9a-f]{32}’))]    正規表現


                                               Clichy/2010-02-03
1.0
                      xPath

• /preceding-sibling::*                    軸


• /element/@attribute                      属性


• /*/@*                                  ワイルドカード

• *[name()=‘table’ and @id=‘1’]          プレディケート

• *[matches(@uuid,(‘[0-9a-f]{32}’))]      正規表現


                                                 Clichy/2010-02-03
XSLT
リファレンス
コマンド




       Clichy/2010-02-03
コマンド
             条件分岐
<xsl:if test=”xPath”>
 ...some code here
</xsl:if>




                        Clichy/2010-02-03
コマンド
             条件分岐
<xsl:choose>
 <xsl:when test=”xPath”>
  ...some code here
 </xsl:when>
 <xsl:when test=”xPath”>
  ...some code here
 </xsl:when>
 <xsl:otherwise>
  ...some code here
 </xsl:otherwise>
</xsl:choose>
                           Clichy/2010-02-03
コマンド
         クエリ, 並び替え
<xsl:for-each select=”xPath” >
 <xsl:for-each select=”xPath” >
  <xsl:sort select=”xPath” />
  <xsl:sort select=”xPath” />
   ...some code here
 </xsl:for-each>
</xsl:for-each>




                                  Clichy/2010-02-03
コマンド
         クエリ, 一括更新
<xsl:apply-templates select=”xPath” >
 <xsl:with-param name=”” select=”xPath” />
 <xsl:sort select=”xPath” />
 <xsl:sort select=”xPath” />
</xsl:apply-templates>


<xsl:template match=”xPath” >
 <xsl:param name=”” select=”xPath” />
 ...some code here
</xsl:template>

                                        Clichy/2010-02-03
コマンド
           サブルーチン
<xsl:call-templates name=”” >
 <xsl:with-param name=”” select=”xPath” />
</xsl:apply-templates>




<xsl:template name=”” >
 <xsl:param name=”” select=”xPath” />
 ...some code here
</xsl:template>

                                        Clichy/2010-02-03
コマンド
                出力
<xsl:value-of select=”xPath” />




                                  Clichy/2010-02-03
コマンド
                出力
<xsl:text>...literal value here</xsl:text>

or,
here

<tag></tag>




                                      Clichy/2010-02-03
コマンド
                出力
<xsl:number count=”xPath” format=””/>
//context based value

<xsl:number value=”” format=””/>
//static value




                                        Clichy/2010-02-03
コマンド
                設定
<xsl:output method=”xml|text|html” />

encoding
standalone
indent
omit-xml-declaration
doctype-public
doctype-system
media-type



                                        Clichy/2010-02-03
xPath
リファレンス
軸 (axis)

<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
               self::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
               child::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
             parent::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
            attribute::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
            ancestor::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
          descendant::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
     preceding-sibling::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
           preceding::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
      following-sibling::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
軸 (axis)
           following::*
<root>
 <trunk index=”1”>
  <branch name=”abc”>
 <trunk index=”2” />
  <branch name=”4D” version=”11”>
   <leaf>
    <vein />
   <leaf>
  </branch>
 </trunk>
 <trunk index=”3” />
</root>
                                    Clichy/2010-02-03
関数




     Clichy/2010-02-03
関数

numeric:    number, format-
  string:   number
   node:    sum
     xml:   round
settings:   ceiling
            floor



                              Clichy/2010-02-03
関数

numeric:    string, name
  string:   contains, starts-with
   node:    concat
     xml:   substring
settings:   substring-before
            substring-after
            normalize space
            translate

                                    Clichy/2010-02-03
関数

numeric:    position
  string:   last
   node:    document
     xml:
settings:




                       Clichy/2010-02-03
関数

numeric: namespace-uri
  string: unparsed-entity-uri
   node:
     xml:
settings:




                                Clichy/2010-02-03
関数

numeric:    system-property
  string:   function-available
   node:
     xml:
settings:




                                 Clichy/2010-02-03
EXSLT 拡張関数




             Clichy/2010-02-03
EXSLT 拡張関数

   math:    math:min, max
     str:   math:lowest, highest
     set:   math:tan, cos, sin
    dyn:    math:atan, acos, asin
   date:    math:random
    exsl:   math:abs
random:     math:power
   func:    math:exp, log, sqrt
 regexp:    math:constant
                                    Clichy/2010-02-03
EXSLT 拡張関数

   math:    str:encode-uri
     str:   str:decode-uri
     set:   str:padding
    dyn:    str:concat
   date:    str:align
    exsl:
random:
   func:
 regexp:
                             Clichy/2010-02-03
EXSLT 拡張関数

   math:    set:difference
     str:   set:distinct
     set:   set:has-same-
    dyn:    node
   date:    set:intersection
    exsl:   set:leading
random:     set:trainling
   func:
 regexp:
                               Clichy/2010-02-03
EXSLT 拡張関数

   math:    dyn:evaluate
     str:
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                           Clichy/2010-02-03
EXSLT 拡張関数

   math:    date:date-time
     str:
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                             Clichy/2010-02-03
EXSLT 拡張関数

   math:    exsl:object-type
     str:   exsl:node-set
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                               Clichy/2010-02-03
EXSLT 拡張関数

   math:
     str:
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                  Clichy/2010-02-03
EXSLT 拡張関数

   math:
     str:
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                  Clichy/2010-02-03
EXSLT 拡張関数

   math:
     str:
     set:
    dyn:
   date:
    exsl:
random:
   func:
 regexp:
                  Clichy/2010-02-03
4D 拡張関数

exsl4D: exsl4D:format-number
        exsl4D:format-value
        exsl4D:max
        exsl4D:min
        exsl4D:max-string-length
        exsl4D:max-value-length



                              Clichy/2010-02-03

More Related Content

Viewers also liked

Xslt
XsltXslt
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
Kumar
 
XSLT. Basic.
XSLT. Basic.XSLT. Basic.
XSLT. Basic.
Alexander Kirillov
 
Session 4
Session 4Session 4
DITA-OT 2.x: Discover What's New in Toolkit Two
DITA-OT 2.x: Discover What's New in Toolkit TwoDITA-OT 2.x: Discover What's New in Toolkit Two
DITA-OT 2.x: Discover What's New in Toolkit Two
Robert Anderson
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
Bertrand Delacretaz
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
jimfuller2009
 
Upgrading PDF Plugins to DITA_DITA-OT Day 2016
Upgrading PDF Plugins to DITA_DITA-OT Day 2016Upgrading PDF Plugins to DITA_DITA-OT Day 2016
Upgrading PDF Plugins to DITA_DITA-OT Day 2016
IXIASOFT
 

Viewers also liked (8)

Xslt
XsltXslt
Xslt
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
XSLT. Basic.
XSLT. Basic.XSLT. Basic.
XSLT. Basic.
 
Session 4
Session 4Session 4
Session 4
 
DITA-OT 2.x: Discover What's New in Toolkit Two
DITA-OT 2.x: Discover What's New in Toolkit TwoDITA-OT 2.x: Discover What's New in Toolkit Two
DITA-OT 2.x: Discover What's New in Toolkit Two
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
 
Upgrading PDF Plugins to DITA_DITA-OT Day 2016
Upgrading PDF Plugins to DITA_DITA-OT Day 2016Upgrading PDF Plugins to DITA_DITA-OT Day 2016
Upgrading PDF Plugins to DITA_DITA-OT Day 2016
 

Similar to XSLT 2010-03-03

Docmgt_002
Docmgt_002Docmgt_002
Docmgt_002
Ryoki Tsusumi
 
textsearch_jaで全文検索
textsearch_jaで全文検索textsearch_jaで全文検索
textsearch_jaで全文検索
Akio Ishida
 
Oracle GoldenGate導入Tips
Oracle GoldenGate導入TipsOracle GoldenGate導入Tips
Oracle GoldenGate導入Tips
オラクルエンジニア通信
 
「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ
Yasuhito Yabe
 
JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013
dynamis
 
Reladomo in Scala #scala_ks
Reladomo in Scala #scala_ks Reladomo in Scala #scala_ks
Reladomo in Scala #scala_ks
Hiroshi Ito
 
RとSQLiteで気軽にデータベース作成
RとSQLiteで気軽にデータベース作成RとSQLiteで気軽にデータベース作成
RとSQLiteで気軽にデータベース作成弘毅 露崎
 
Xml builderの紹介
Xml builderの紹介Xml builderの紹介
Xml builderの紹介Hiraku Nakano
 
イマドキの現場で使えるJavaライブラリ事情
イマドキの現場で使えるJavaライブラリ事情イマドキの現場で使えるJavaライブラリ事情
イマドキの現場で使えるJavaライブラリ事情
takezoe
 
CRF を使った Web 本文抽出 for WebDB Forum 2011
CRF を使った Web 本文抽出 for WebDB Forum 2011CRF を使った Web 本文抽出 for WebDB Forum 2011
CRF を使った Web 本文抽出 for WebDB Forum 2011
Shuyo Nakatani
 
activerecord-oracle_enhanced-adapterのご紹介
activerecord-oracle_enhanced-adapterのご紹介activerecord-oracle_enhanced-adapterのご紹介
activerecord-oracle_enhanced-adapterのご紹介Kevin Toyoda
 
JavaScript.Next
JavaScript.NextJavaScript.Next
JavaScript.Next
dynamis
 
Mongo db + xsd:xml(20130219)
Mongo db + xsd:xml(20130219)Mongo db + xsd:xml(20130219)
Mongo db + xsd:xml(20130219)
Michael Nguyen
 
XLWrapについてのご紹介
XLWrapについてのご紹介XLWrapについてのご紹介
XLWrapについてのご紹介Ohsawa Goodfellow
 
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介Shintaro Hosoai
 
GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法博文 斉藤
 
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方Alfresco勉強会20120829: やさしいShareダッシュレットの作り方
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方linzhixing
 
「Html sql」で図書館hpにアクセスしてみよう
「Html sql」で図書館hpにアクセスしてみよう「Html sql」で図書館hpにアクセスしてみよう
「Html sql」で図書館hpにアクセスしてみようKentaro Matsui
 
Seasarプロジェクト徹底攻略
Seasarプロジェクト徹底攻略Seasarプロジェクト徹底攻略
Seasarプロジェクト徹底攻略
takezoe
 

Similar to XSLT 2010-03-03 (20)

Docmgt_002
Docmgt_002Docmgt_002
Docmgt_002
 
textsearch_jaで全文検索
textsearch_jaで全文検索textsearch_jaで全文検索
textsearch_jaで全文検索
 
Oracle GoldenGate導入Tips
Oracle GoldenGate導入TipsOracle GoldenGate導入Tips
Oracle GoldenGate導入Tips
 
「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ
 
JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013
 
Reladomo in Scala #scala_ks
Reladomo in Scala #scala_ks Reladomo in Scala #scala_ks
Reladomo in Scala #scala_ks
 
RとSQLiteで気軽にデータベース作成
RとSQLiteで気軽にデータベース作成RとSQLiteで気軽にデータベース作成
RとSQLiteで気軽にデータベース作成
 
Xml builderの紹介
Xml builderの紹介Xml builderの紹介
Xml builderの紹介
 
イマドキの現場で使えるJavaライブラリ事情
イマドキの現場で使えるJavaライブラリ事情イマドキの現場で使えるJavaライブラリ事情
イマドキの現場で使えるJavaライブラリ事情
 
CRF を使った Web 本文抽出 for WebDB Forum 2011
CRF を使った Web 本文抽出 for WebDB Forum 2011CRF を使った Web 本文抽出 for WebDB Forum 2011
CRF を使った Web 本文抽出 for WebDB Forum 2011
 
activerecord-oracle_enhanced-adapterのご紹介
activerecord-oracle_enhanced-adapterのご紹介activerecord-oracle_enhanced-adapterのご紹介
activerecord-oracle_enhanced-adapterのご紹介
 
JavaScript.Next
JavaScript.NextJavaScript.Next
JavaScript.Next
 
Mongo db + xsd:xml(20130219)
Mongo db + xsd:xml(20130219)Mongo db + xsd:xml(20130219)
Mongo db + xsd:xml(20130219)
 
XLWrapについてのご紹介
XLWrapについてのご紹介XLWrapについてのご紹介
XLWrapについてのご紹介
 
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介
テキスト型Domain Specific Language (DSL) 開発フレームワークXtext の紹介
 
GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法
 
計算機理論入門09
計算機理論入門09計算機理論入門09
計算機理論入門09
 
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方Alfresco勉強会20120829: やさしいShareダッシュレットの作り方
Alfresco勉強会20120829: やさしいShareダッシュレットの作り方
 
「Html sql」で図書館hpにアクセスしてみよう
「Html sql」で図書館hpにアクセスしてみよう「Html sql」で図書館hpにアクセスしてみよう
「Html sql」で図書館hpにアクセスしてみよう
 
Seasarプロジェクト徹底攻略
Seasarプロジェクト徹底攻略Seasarプロジェクト徹底攻略
Seasarプロジェクト徹底攻略
 

More from kmiyako

Build an iOS app with Ionic and 4D
Build an iOS app with Ionic and 4DBuild an iOS app with Ionic and 4D
Build an iOS app with Ionic and 4D
kmiyako
 
4D WORLD TOUR 2017
4D WORLD TOUR 20174D WORLD TOUR 2017
4D WORLD TOUR 2017
kmiyako
 
Leaflet
LeafletLeaflet
Leaflet
kmiyako
 
Inside Multi-Threading
Inside Multi-ThreadingInside Multi-Threading
Inside Multi-Threading
kmiyako
 
4D Tags
4D Tags4D Tags
4D Tags
kmiyako
 
Mirroring
MirroringMirroring
Mirroring
kmiyako
 
Objects Fields
Objects FieldsObjects Fields
Objects Fields
kmiyako
 
Code Optimisation
Code OptimisationCode Optimisation
Code Optimisation
kmiyako
 
Auto Update
Auto UpdateAuto Update
Auto Update
kmiyako
 
Classic Query Editor
Classic Query EditorClassic Query Editor
Classic Query Editor
kmiyako
 
Web area-phone-home
Web area-phone-homeWeb area-phone-home
Web area-phone-home
kmiyako
 
MONET研究会 #14
MONET研究会 #14MONET研究会 #14
MONET研究会 #14
kmiyako
 
4d
4d4d
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
kmiyako
 
Journaling slides
Journaling slidesJournaling slides
Journaling slides
kmiyako
 
Unicode-v11-5
Unicode-v11-5Unicode-v11-5
Unicode-v11-5
kmiyako
 
Unicode-v11-0
Unicode-v11-0Unicode-v11-0
Unicode-v11-0
kmiyako
 
アップグレードセミナー
アップグレードセミナーアップグレードセミナー
アップグレードセミナー
kmiyako
 
4D Write Pro
4D Write Pro4D Write Pro
4D Write Pro
kmiyako
 
バックアップと復元
バックアップと復元バックアップと復元
バックアップと復元
kmiyako
 

More from kmiyako (20)

Build an iOS app with Ionic and 4D
Build an iOS app with Ionic and 4DBuild an iOS app with Ionic and 4D
Build an iOS app with Ionic and 4D
 
4D WORLD TOUR 2017
4D WORLD TOUR 20174D WORLD TOUR 2017
4D WORLD TOUR 2017
 
Leaflet
LeafletLeaflet
Leaflet
 
Inside Multi-Threading
Inside Multi-ThreadingInside Multi-Threading
Inside Multi-Threading
 
4D Tags
4D Tags4D Tags
4D Tags
 
Mirroring
MirroringMirroring
Mirroring
 
Objects Fields
Objects FieldsObjects Fields
Objects Fields
 
Code Optimisation
Code OptimisationCode Optimisation
Code Optimisation
 
Auto Update
Auto UpdateAuto Update
Auto Update
 
Classic Query Editor
Classic Query EditorClassic Query Editor
Classic Query Editor
 
Web area-phone-home
Web area-phone-homeWeb area-phone-home
Web area-phone-home
 
MONET研究会 #14
MONET研究会 #14MONET研究会 #14
MONET研究会 #14
 
4d
4d4d
4d
 
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
初心者からプロフェッショナルまで~データベース開発ソフト4Dの魅力を徹底紹介~
 
Journaling slides
Journaling slidesJournaling slides
Journaling slides
 
Unicode-v11-5
Unicode-v11-5Unicode-v11-5
Unicode-v11-5
 
Unicode-v11-0
Unicode-v11-0Unicode-v11-0
Unicode-v11-0
 
アップグレードセミナー
アップグレードセミナーアップグレードセミナー
アップグレードセミナー
 
4D Write Pro
4D Write Pro4D Write Pro
4D Write Pro
 
バックアップと復元
バックアップと復元バックアップと復元
バックアップと復元
 

XSLT 2010-03-03

  • 1. All About XSLT 4D デベロッパカンファレンス 2010
  • 2. All About XSLT • このセッションの内容 ‣ XSLTの概要 ‣ XSLTの利点 ‣ XSLTと4D ‣ XSLTの作成, 編集, 検証 ‣ XSLTの応用 Clichy/2010-02-03
  • 5. XSLTの利点 • XMLを変換するための標準の技術 • XMLを解析, 再構成, 統計, 並び替え, グループ... ✦xPathは強力なクエリ言語 • XMLのノードタイプすべてに対してアクセス... ✦コメントの出力OK=4D HTML TAGS ! Clichy/2010-02-03
  • 6. XSLTの利点 <region name="ヨーロッパ"> ヨーロッパ ! <country name="イギリス"> イギリス ! ! <language name="英語"> 英語 ! </country> ! フランス <country name="フランス"> ! ! 仏語 <language name="仏語"> ! </country> </region> <region name="アフリカ"> アフリカ ! <country name="カメルーン"> カメルーン ! ! <language name="仏語" /> 仏語 ! ! <language name="英語" /> 英語 ! </country> ! <country name="ガボン"> ガボン ! ! <language name="仏語"> 仏語 ! </country> </region> Clichy/2010-02-03
  • 7. XSLTの利点 <language name="英語"> 英語 ! <region name="ヨーロッパ"> ヨーロッパ ! ! <country name="イギリス"/> イギリス ! </region> ! <region name="アフリカ"> アフリカ ! ! <country name="カメルーン"/> ! </region> </language> <language name="仏語"> 仏語 ! <region name="ヨーロッパ"> ! ! <country name="フランス"/> フランス ! </region> ! <region name="アフリカ"> ! ! <country name="ガボン"/> ガボン ! ! <country name="カメルーン"/> カメルーン ! </region> </language> Clichy/2010-02-03
  • 8. XSLTの利点 <country name="イギリス" region="ヨーロッパ"> イギリス ヨーロッパ ! ! <language name="英語"/> </country> <country name="ガボン" region="アフリカ"> ガボン アフリカ ! ! <language name="仏語"/> 仏語 </country> <country name="カメルーン" region="アフリカ"> カメルーン ! ! <language name="仏語"/> ! ! <language name="英語"/> </country> <country name="フランス" region="ヨーロッパ"> フランス ! ! <language name="仏語"/> </country> Clichy/2010-02-03
  • 11. XSLTの概要 • XML形式で記述するプログラム言語 ‣ 実行前にXML妥当性検証, 解析, コンパイル ‣ 要素はコマンド ‣ 属性は命名引数 ‣ 要素値は数が定まらない引数 Clichy/2010-02-03
  • 12. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> Clichy/2010-02-03
  • 13. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> コマンド Clichy/2010-02-03
  • 14. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> リテラルな出力 Clichy/2010-02-03
  • 15. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> xPath Clichy/2010-02-03
  • 16. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> 関数 Clichy/2010-02-03
  • 17. XSLTの概要 <xsl:template match=”/”> <data> <xsl:for-each select=”//*[@id&gt;1]”> <month id=”{@id}”> <xsl:value-of select=”name($name)” /> </month> </xsl:for-each> </data> </xsl:template> 変数/引数 Clichy/2010-02-03
  • 19. XSLTと4D • APPLY XSLT TRANSFORMATION ‣ Apache xalan-c ‣ XSLT 1.0 ‣ BLOB; BLOB; BLOB ‣ path; path; path • SET XSLT PARAMETER ‣ “12345” ‣ “‘abc’” Clichy/2010-02-03
  • 20. XSLTと4D • APPLY XSLT TRANSFORMATION ‣ Apache xalan-c ‣ XSLT 1.0 ‣ BLOB; BLOB; BLOB 一時ファイル必要なし ‣ path; path; path • SET XSLT PARAMETER ‣ “12345” ‣ “‘abc’” Clichy/2010-02-03
  • 21. XSLTと4D • APPLY XSLT TRANSFORMATION ‣ Apache xalan-c ‣ XSLT 1.0 ‣ BLOB; BLOB; BLOB 一時ファイル必要なし ‣ path; path; path コンパイルをキープ • SET XSLT PARAMETERimport, include ‣ “12345” ‣ “‘abc’” document(‘’) Clichy/2010-02-03
  • 23. 微妙な関係!? DOM document SAX BLOB XSLT PICTURE TEXT Clichy/2010-02-03
  • 24. 微妙な関係!? DOM document BLOB PICTURE TEXT SAX XSLT Clichy/2010-02-03
  • 25. 微妙な関係!? DOM SAX BLOB document PICTURE TEXT XSLT Clichy/2010-02-03
  • 26. 微妙な関係!? DOM SAX XSLT PICTURE document TEXT BLOB Clichy/2010-02-03
  • 27. 微妙な関係!? TEXT BLOB Regex DOM XSLT SVG (get) SVG animatable PICTURE document SVG (own copy) SVG interactive SAX Clichy/2010-02-03
  • 28. xPath
  • 29. xPath • XMLコマンドはxPathサポートしている? ‣ DOM Create XML element 4DではElement[ElementNum]シンタックスを使用した添字によるXPath要素への ‣ DOM Find XML element アクセスも使用できます。例えば以下の構造があるとき: ‣ DOM    <RootElement> SET XML VALUE       <Elem1>          <Elem2>aaa</Elem2> • element[index]          <Elem2>bbb</Elem2>          <Elem2>ccc</Elem2> ‣ インデックスで要素が参照できるだけ。       </Elem1>    </RootElement> ‣ それ以外のxPathはNG。 XPath記法では /RootElement/Elem1/Elem2[3] シンタックスを使用して"ccc"値 にアクセスできます。 http://www.4d.com/docs/CMJ/CMJ10099.HTM Clichy/2010-02-03
  • 30. xPath • /preceding-sibling::* 軸 • /element/@attribute 属性 • /*/@* ワイルドカード • *[name()=‘table’ and @id=‘1’] プレディケート • *[matches(@uuid,(‘[0-9a-f]{32}’))] 正規表現 Clichy/2010-02-03
  • 31. 1.0 xPath • /preceding-sibling::* 軸 • /element/@attribute 属性 • /*/@* ワイルドカード • *[name()=‘table’ and @id=‘1’] プレディケート • *[matches(@uuid,(‘[0-9a-f]{32}’))] 正規表現 Clichy/2010-02-03
  • 33. コマンド Clichy/2010-02-03
  • 34. コマンド 条件分岐 <xsl:if test=”xPath”> ...some code here </xsl:if> Clichy/2010-02-03
  • 35. コマンド 条件分岐 <xsl:choose> <xsl:when test=”xPath”> ...some code here </xsl:when> <xsl:when test=”xPath”> ...some code here </xsl:when> <xsl:otherwise> ...some code here </xsl:otherwise> </xsl:choose> Clichy/2010-02-03
  • 36. コマンド クエリ, 並び替え <xsl:for-each select=”xPath” > <xsl:for-each select=”xPath” > <xsl:sort select=”xPath” /> <xsl:sort select=”xPath” /> ...some code here </xsl:for-each> </xsl:for-each> Clichy/2010-02-03
  • 37. コマンド クエリ, 一括更新 <xsl:apply-templates select=”xPath” > <xsl:with-param name=”” select=”xPath” /> <xsl:sort select=”xPath” /> <xsl:sort select=”xPath” /> </xsl:apply-templates> <xsl:template match=”xPath” > <xsl:param name=”” select=”xPath” /> ...some code here </xsl:template> Clichy/2010-02-03
  • 38. コマンド サブルーチン <xsl:call-templates name=”” > <xsl:with-param name=”” select=”xPath” /> </xsl:apply-templates> <xsl:template name=”” > <xsl:param name=”” select=”xPath” /> ...some code here </xsl:template> Clichy/2010-02-03
  • 39. コマンド 出力 <xsl:value-of select=”xPath” /> Clichy/2010-02-03
  • 40. コマンド 出力 <xsl:text>...literal value here</xsl:text> or, here <tag></tag> Clichy/2010-02-03
  • 41. コマンド 出力 <xsl:number count=”xPath” format=””/> //context based value <xsl:number value=”” format=””/> //static value Clichy/2010-02-03
  • 42. コマンド 設定 <xsl:output method=”xml|text|html” /> encoding standalone indent omit-xml-declaration doctype-public doctype-system media-type Clichy/2010-02-03
  • 44. 軸 (axis) <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 45. 軸 (axis) self::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 46. 軸 (axis) child::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 47. 軸 (axis) parent::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 48. 軸 (axis) attribute::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 49. 軸 (axis) ancestor::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 50. 軸 (axis) descendant::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 51. 軸 (axis) preceding-sibling::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 52. 軸 (axis) preceding::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 53. 軸 (axis) following-sibling::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 54. 軸 (axis) following::* <root> <trunk index=”1”> <branch name=”abc”> <trunk index=”2” /> <branch name=”4D” version=”11”> <leaf> <vein /> <leaf> </branch> </trunk> <trunk index=”3” /> </root> Clichy/2010-02-03
  • 55. 関数 Clichy/2010-02-03
  • 56. 関数 numeric: number, format- string: number node: sum xml: round settings: ceiling floor Clichy/2010-02-03
  • 57. 関数 numeric: string, name string: contains, starts-with node: concat xml: substring settings: substring-before substring-after normalize space translate Clichy/2010-02-03
  • 58. 関数 numeric: position string: last node: document xml: settings: Clichy/2010-02-03
  • 59. 関数 numeric: namespace-uri string: unparsed-entity-uri node: xml: settings: Clichy/2010-02-03
  • 60. 関数 numeric: system-property string: function-available node: xml: settings: Clichy/2010-02-03
  • 61. EXSLT 拡張関数 Clichy/2010-02-03
  • 62. EXSLT 拡張関数 math: math:min, max str: math:lowest, highest set: math:tan, cos, sin dyn: math:atan, acos, asin date: math:random exsl: math:abs random: math:power func: math:exp, log, sqrt regexp: math:constant Clichy/2010-02-03
  • 63. EXSLT 拡張関数 math: str:encode-uri str: str:decode-uri set: str:padding dyn: str:concat date: str:align exsl: random: func: regexp: Clichy/2010-02-03
  • 64. EXSLT 拡張関数 math: set:difference str: set:distinct set: set:has-same- dyn: node date: set:intersection exsl: set:leading random: set:trainling func: regexp: Clichy/2010-02-03
  • 65. EXSLT 拡張関数 math: dyn:evaluate str: set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 66. EXSLT 拡張関数 math: date:date-time str: set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 67. EXSLT 拡張関数 math: exsl:object-type str: exsl:node-set set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 68. EXSLT 拡張関数 math: str: set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 69. EXSLT 拡張関数 math: str: set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 70. EXSLT 拡張関数 math: str: set: dyn: date: exsl: random: func: regexp: Clichy/2010-02-03
  • 71. 4D 拡張関数 exsl4D: exsl4D:format-number exsl4D:format-value exsl4D:max exsl4D:min exsl4D:max-string-length exsl4D:max-value-length Clichy/2010-02-03