speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
292 stars 36 forks source link

simplest approach to variable invocation #450

Closed pr-apes closed 1 year ago

pr-apes commented 1 year ago

@pgundlach,

would it be possible that the simplest method to invoke a variable could work?

<Layout xmlns="urn:speedata.de:2009/publisher/en"
    xmlns:sd="urn:speedata:2009/publisher/functions/en">

  <SetVariable variable="whatever">
    <Output>
      <Text>
        <Paragraph>
          <Value>This shouldn't be displayed</Value>
        </Paragraph>
      </Text>
    </Output>
  </SetVariable>

  <SetVariable variable="only">
    <Output>
      <Text>
        <Paragraph>
          <Value>Only this should be displayed</Value>
        </Paragraph>
      </Text>
    </Output>
  </SetVariable>

  <Record element="data">
    <Copy-of select="$none"/>
  </Record>
</Layout>

I mean, only get the contents of <SetVariable> when <Copy-of> invokes it name.

Many thanks for your help.

pgundlach commented 1 year ago

This is what execute=later is for:

<Layout xmlns="urn:speedata.de:2009/publisher/en"
    xmlns:sd="urn:speedata:2009/publisher/functions/en">

  <SetVariable variable="whatever" execute="later">
    <Output>
      <Text>
        <Paragraph>
          <Value>This shouldn't be displayed</Value>
        </Paragraph>
      </Text>
    </Output>
  </SetVariable>

  <SetVariable variable="only" execute="later">
    <Output>
      <Text>
        <Paragraph>
          <Value>Only this should be displayed</Value>
        </Paragraph>
      </Text>
    </Output>
  </SetVariable>

  <Record element="data">
    <Copy-of select="$only"/>
  </Record>
</Layout>
pr-apes commented 1 year ago

Sorry, I totally forgot that.

Completely my fault.