Skip to content

Commit

Permalink
Fix Value in Function
Browse files Browse the repository at this point in the history
  • Loading branch information
pgundlach committed Apr 21, 2024
1 parent c308c5d commit 8785526
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 35 deletions.
1 change: 1 addition & 0 deletions doc/commands-xml/commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3790,6 +3790,7 @@
<optional><cmd name="ClearPage"/></optional>
<optional><cmd name="Column"/></optional>
<optional><cmd name="Columns"/></optional>
<optional><cmd name="Copy-of"/></optional>
<optional><cmd name="ForAll"/></optional>
<optional><cmd name="Group"/></optional>
<optional><cmd name="LoadDataset"/></optional>
Expand Down
1 change: 1 addition & 0 deletions qa/programming/functiongeneral/data.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<data>
<element></element>
<element></element>
</data>
106 changes: 72 additions & 34 deletions qa/programming/functiongeneral/layout.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,86 @@
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en"
xmlns:fn="fn">
xmlns:fn="mynamespace">

<Pageformat height="10cm" width="6cm"></Pageformat>
<Record element="data">
<PlaceObject>
<Textblock>
<Paragraph>
<Value select="fn:add(3,4)" />
</Paragraph>
</Textblock>
</PlaceObject>
<PlaceObject>
<Textblock>
<Value select="fn:sixelement(2,3)" />
</Textblock>
</PlaceObject>

<PlaceObject>
<Table padding="4pt">
<Columns>
<Value select="fn:columns(2)" />
</Columns>
<Tr>
<Td>
<Paragraph>
<Value>Value</Value>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value>Squared</Value>
</Paragraph>
</Td>
</Tr>
<Loop select="5" variable="i">
<Value select="fn:tr($i)" />
</Loop>
</Table>
</PlaceObject>
<PlaceObject>
<Textblock>
<Paragraph>
<Value select="fn:forall()"></Value>
</Paragraph>
</Textblock>
</PlaceObject>

<Function name="fn:para">
</Record>

<Function name="fn:add">
<Param name="a" />
<Param name="b" />
<Value select="$a + $b" />
</Function>

<Function name="fn:sixelement">
<Param name="first" />
<Param name="second" />
<Paragraph>
<Value select="$first * $second"></Value>
<Value> </Value>
<Value select="local-name(*)"></Value>
<Value select="$first * $second" />
<Value />
<Value select="local-name(*[1])" />
</Paragraph>
</Function>

<SetVariable variable="tablerule">
<Tablerule color="black" rulewidth="2pt" />
</SetVariable>

<Function name="fn:tr">
<Param name="first" />
<Copy-of select="$tablerule" />
<Tr>
<Td>
<Paragraph><Value select="$first" /></Paragraph>
<Paragraph>
<Value select="$first" />
</Paragraph>
</Td>
<Td>
<Paragraph><Value select="$first * $first" /></Paragraph>
<Paragraph>
<Value select="$first * $first" />
</Paragraph>
</Td>
</Tr>
</Function>
Expand All @@ -38,30 +97,9 @@
</Switch>
</Function>

<Record element="data">
<PlaceObject>
<Textblock>
<Value select="fn:para(2,3)"></Value>
</Textblock>
</PlaceObject>

<PlaceObject>
<Table padding="4pt">
<Columns>
<Value select="fn:columns(2)" />
</Columns>
<Tr>
<Td>
<Paragraph><Value>Value</Value></Paragraph>
</Td>
<Td>
<Paragraph><Value>Squared</Value></Paragraph>
</Td>
</Tr>
<Loop select="5" variable="i">
<Value select="fn:tr($i)"></Value>
</Loop>
</Table>
</PlaceObject>
</Record>
<Function name="fn:forall">
<ForAll select="*">
<Value select="local-name(.)"></Value>
</ForAll>
</Function>
</Layout>
Binary file modified qa/programming/functiongeneral/reference.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions schema/layoutschema-de.rng
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,9 @@
<optional>
<ref name="e_Columns"></ref>
</optional>
<optional>
<ref name="e_Copy-of"></ref>
</optional>
<optional>
<ref name="e_ForAll"></ref>
</optional>
Expand Down
1 change: 1 addition & 0 deletions schema/layoutschema-de.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,7 @@
<xs:element minOccurs="0" ref="en:ClearPage"/>
<xs:element minOccurs="0" ref="en:Column"/>
<xs:element minOccurs="0" ref="en:Columns"/>
<xs:element minOccurs="0" ref="en:Copy-of"/>
<xs:element minOccurs="0" ref="en:ForAll"/>
<xs:element minOccurs="0" ref="en:Group"/>
<xs:element minOccurs="0" ref="en:LoadDataset"/>
Expand Down
3 changes: 3 additions & 0 deletions schema/layoutschema-en.rng
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,9 @@
<optional>
<ref name="e_Columns"></ref>
</optional>
<optional>
<ref name="e_Copy-of"></ref>
</optional>
<optional>
<ref name="e_ForAll"></ref>
</optional>
Expand Down
1 change: 1 addition & 0 deletions schema/layoutschema-en.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,7 @@
<xs:element minOccurs="0" ref="en:ClearPage"/>
<xs:element minOccurs="0" ref="en:Column"/>
<xs:element minOccurs="0" ref="en:Columns"/>
<xs:element minOccurs="0" ref="en:Copy-of"/>
<xs:element minOccurs="0" ref="en:ForAll"/>
<xs:element minOccurs="0" ref="en:Group"/>
<xs:element minOccurs="0" ref="en:LoadDataset"/>
Expand Down
6 changes: 5 additions & 1 deletion src/lua/publisher/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1195,15 +1195,19 @@ function commands.func(layoutxml, dataxml)

local x = publisher.dispatch(layoutxml,copy)
local res = {}
local has_value = false
for i = 1, #x do
local thiselt = x[i]
local eltname = publisher.elementname(thiselt)
if eltname ~= "Param" then
res[#res+1] = thiselt
end
if eltname == "Value" then
has_value = true
end
end

res.raw = true
res.raw = not has_value
return res,nil
end
-- name, namespace, function, minarg, maxarg
Expand Down

0 comments on commit 8785526

Please sign in to comment.