6.11 xml リソース<bs:xml-resource-master>
6.11.1機能説明
biz-Streamライブラリがxmlリソースを使用するためのリソース情報を定義します。
6.11.2属性説明
属性名 | 指定 | 説明 | 型 | 指定内容 | 初期値 |
---|---|---|---|---|---|
master-name | 必須 | 定義名 | CDATA | - | |
url | 必須 | ファイル名 | xsd:anyURIもしくは、ファイルパス | ファイルが存在するURL ※1 | - |
- ※1デフォルトエンコーディングはUTF-8のため、データソースとして指定するxmlファイルのエンコードがShift_JISの場合は、
ファイルの先頭に
<?xml version="1.0" encoding="Shift_JIS"?>
の記載が必要です。
6.11.3記述例
bs:xml-resource-masterドキュメントレイアウトサンプル
bs:xml-resource-masterドキュメントレイアウトサンプル
(『<biz-Stream_home>/sample/xml/datasource-master/datasource-masterXmlDataSourceSample1-doc.xml
』)
<?xml version="1.0" encoding="UTF-8"?> <!-- XML file created by biz-Stream Designer --> <!-- biz-Stream Copyright BrainSellers.com Corp. --> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:bs="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" version="5.0.0"> <bs:datasource-master-set> <bs:datasource-master master-name="xml-source" position="inherit"> <bs:calculate-master master-name="小計" break-list="顧客名"> <bs:calculate-statement function="sum(個数)"/> <bs:calculate-statement function="sum(金額)"/> <bs:calculate-function column-name="個数小計" function="sum(個数)"/> <bs:calculate-function column-name="金額小計" function="sum(金額)"/> </bs:calculate-master> <bs:calculate-master master-name="合計"> <bs:calculate-statement function="sum(個数)"/> <bs:calculate-statement function="sum(金額)"/> <bs:calculate-function column-name="個数合計" function="sum(個数)"/> <bs:calculate-function column-name="金額合計" function="sum(金額)"/> </bs:calculate-master> <bs:group-suppress name="a" conditions="and"> <bs:group-items column-name="地区コード" new-page="true"/> <bs:group-items column-name="顧客名" priority="1" new-page="false"/> </bs:group-suppress> <bs:xml-master-reference master-reference="xml-field"/> </bs:datasource-master> <bs:xml-master master-name="xml-field"> <bs:xml-statement master-reference="xml-resource"> let $xml := . let $seq := $xml//li for $a in $seq where contains($a/@class, 'item') return <record> <column1>{$a/col1/text()}</column1> {$a/col2} {$a/col3} <column4>{normalize-space($a/col4)}</column4> </record> </bs:xml-statement> <bs:data-type column-name="地区コード" column-no="1" type="decimal"/> <bs:data-type column-name="顧客名" column-no="2" type="char"/> <bs:data-type column-name="個数" column-no="3" type="decimal"/> <bs:data-type column-name="金額" column-no="4" type="decimal"/> </bs:xml-master> <bs:xml-resource-master master-name="xml-resource" url="${base-dir}/sample/xml/datasource-master/datasource-masterXmlDataSourceSample1-data.xml"/> </bs:datasource-master-set> <fo:layout-master-set> <fo:simple-page-master master-name="A4" page-height="297mm" page-width="210mm"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="A4" name="bizsheet" bs:local-page-control="none"> <fo:flow flow-name="xsl-region-body"> <bs:block-container> <bs:include href="${base-dir}/sample/xml/datasource-master/datasource-masterXmlDataSourceSample1-page.xml"/> </bs:block-container> </fo:flow> </fo:page-sequence> </fo:root>
bs:xml-resource-masterページレイアウトサンプル
(『<biz-Stream_home>/sample/xml/datasource-master/datasource-masterXmlDataSourceSample1-page.xml
』)
<?xml version="1.0" encoding="UTF-8"?> <!-- XML file created by biz-Stream Designer --> <!-- biz-Stream Copyright BrainSellers.com Corp. --> <Layout Width="210mm" Height="297mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0"> <Label Name="タイトル" X="75" Y="280" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="18" FontStyle="PLAIN" Narrow="none">販売集計(今月)</Label> <flow-area name="area" x="30" y="270" width="141" height="200" master-reference="xml-source" no-data-disabled="false"> <flow-table name="header" line-height="20" record-type="header" view="page" border-width="0.1" border-color="0,0,0"> <flow-table-cell cell-width="47" align="vertical" text-align="left" cell-align="bottom" narrow="size"> <Label Width="47" Height="10" X="0" Y="0" Horizon="right" Vertical="center" Vector="horizon" Font="MSGothic" FontColor="0,0,0" FontSize="16" FontStyle="PLAIN" Narrow="horizon">地区コード:</Label> <Label Width="47" Height="10" Horizon="center" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="14" FontStyle="PLAIN" Narrow="horizon">顧客名</Label> </flow-table-cell> <flow-table-cell cell-width="47" align="vertical" text-align="left" cell-align="bottom" narrow="size"> <Currency Name="地区コード" Width="47" Height="10" X="0" Y="0" Horizon="left" Vertical="center" Vector="horizon" Font="Courier" FontSize="20" FontStyle="PLAIN" color-plus="0,0,0" Narrow="horizon" format="#,##0">123</Currency> <Label Width="47" Height="10" Horizon="center" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="14" FontStyle="PLAIN" Narrow="horizon">個数</Label> </flow-table-cell> <flow-table-cell cell-width="47" align="horizon" text-align="left" cell-align="bottom" narrow="size"> <Label Width="47" Height="10" Horizon="center" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="14" FontStyle="PLAIN" Narrow="horizon">金額</Label> </flow-table-cell> </flow-table> <flow-table name="deatils" line-height="9.507" record-type="details" view="layout" border-width="0.1"> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Label Name="顧客名" X="1" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon"/> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="個数" Width="45.5" X="1" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="#,##0"/> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="金額" Width="45.5" X="0" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="\#,##0"/> </flow-table-cell> </flow-table> <flow-table name="小計" line-height="9.172" record-type="subtotal" view="layout"> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="center" cell-align="center" narrow="size"> <Label X="1" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">(顧客別小計)</Label> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="個数小計" Width="45.5" X="1" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="#,##0"/> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="金額小計" Width="45.5" X="0" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="\#,##0"/> </flow-table-cell> </flow-table> <flow-table name="合計" line-height="9.172" record-type="total" view="layout"> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="center" cell-align="center" narrow="size"> <Label X="1" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">合計</Label> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="個数合計" Width="45.5" X="1" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="#,##0"/> </flow-table-cell> <flow-table-cell cell-width="47" border-color="0,0,0" align="horizon" text-align="left" cell-align="center" narrow="size"> <Currency Name="金額合計" Width="45.5" X="0" Horizon="right" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon" format="\#,##0"/> </flow-table-cell> </flow-table> </flow-area> <Line X="30" Y="260" StartX="0" StartY="0" EndX="141" EndY="0" Horizon="left" Vertical="bottom" LineWidth="0.5" LineStyle="Solid"/> </Layout>