Matt Sergeant

NAME

AxKit::XSP::Demo::SimpleInputAttributes - tag library to demonstrate SimpleTaglib Input Attributes

SYNOPSIS

In http.conf or .htaccess:

    AxAddXSPTaglib AxKit::XSP::Demo::SimpleInputAttributes

In XSP page:

  <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
            xmlns:demo="http://www.nsds.com/NS/xsp/demo/simple-input-attributes"
            indent-result="yes"
  >

DESCRIPTION

SimpleTaglib (STL) uses Perl function attributes to define how XML input gets handled. This tag library demonstrates the various methods available in STL for reading XML input.

TAG REFERENCE

attrib

    <demo:attrib/>

    <demo:attrib parameter="value"/>

This tag demonstrates the SimpleTaglib 'attrib' input attribute, which passes XML attributes to the handler function via the attribute hash (the third parameter of the handler function, typically named '%attr').

child

    <demo:child/>

    <demo:child>
      <demo:parameter>value</demo:parameter>
    </demo:child>

This tag demonstrates the SimpleTaglib 'child' input attribute. XML input from child tags can be accessed via the '$attr_' variables in the code fragment returned by the handler function.

attribOrChild

    <demo:attribOrChild/>

    <demo:attribOrChild parameter="value"/>

    <demo:attribOrChild>
      <demo:parameter>value</demo:parameter>
    </demo:attribOrChild>

    <demo:attribOrChild parameter="value1">
      <demo:parameter>value2</demo:parameter>
    </demo:attribOrChild>

This tag demonstrates the SimpleTaglib 'attribOrChild' input attribute. XML input from attributes or child tags can be accessed via the '$attr_' variables in the code fragment returned by the handler function. Input from a child tag takes precedence over attributes.

childStruct

    <demo:childStruct/>

    <demo:childStruct>
      <demo:parameter>value</demo:parameter>
    </demo:childStruct>

    <demo:childStruct>
      <demo:parameter>value1</demo:parameter>
      <demo:parameter>value2</demo:parameter>
    </demo:childStruct>

This tag demonstrates the SimpleTaglib 'childStruct' input attribute. XML input from child tags can be accessed via the '%_' hash in the code fragment returned by the handler function. Input from a child tag takes precedence over attributes. Note that complex XML structures can be passed as input using 'childStruct', but the only feature demonstrated here is the use of multiple child tags to set a list value for the parameter. For a more complex example, see "complex-childStruct".

attrib-or-childStruct

    <demo:attrib-or-childStruct/>

    <demo:attrib-or-childStruct parameter="value"/>

    <demo:attrib-or-childStruct>
      <demo:parameter>value</demo:parameter>
    </demo:attrib-or-childStruct>

    <demo:attrib-or-childStruct parameter="value1">
      <demo:parameter>value2</demo:parameter>
    </demo:attrib-or-childStruct>

    <demo:attrib-or-childStruct>
      <demo:parameter>value1</demo:parameter>
      <demo:parameter>value2</demo:parameter>
    </demo:attrib-or-childStruct>

This tag demonstrates how to combine the SimpleTaglib 'attrib' and 'childStruct' input attributes. XML input from attributes or child tags can be accessed via the '%_' hash in the code fragment returned by the handler function. The advantage of this over the 'attribOrChild' input attribute is that multiple child tags can be used to provide a list value for the parameter.

captureContent

    <demo:captureContent/>

    <demo:captureContent>text content</demo:captureContent>

    <demo:captureContent>
      text content
    </demo:captureContent>

This tag demonstrates the SimpleTaglib 'captureContent' input attribute. The XML text input can be accessed via the '$_' variable in the code fragment returned by the handler function.

captureContent-and-keepWhitespace

    <demo:captureContent-and-keepWhitespace/>

    <demo:captureContent-and-keepWhitespace>text content</demo:captureContent-and-keepWhitespace>

    <demo:captureContent-and-keepWhitespace>
      text content
    </demo:captureContent-and-keepWhitespace>

This tag demonstrates the SimpleTaglib 'captureContent' and 'keepWhitespace' input attributes. The XML text input, including surrounding whitespace, can be accessed via the '$_' variable in the code fragment returned by the handler function.

complex-childStruct

    <complex-childStruct
      xmlns="http://www.nsds.com/NS/xsp/demo/simple-input-attributes">
        <add>
            <permission type="user">
                foo
            </permission>
            <permission>
                <type>group</type>
                bar
            </permission>
            <target>/test.html</target>
            <comment lang="en" day="Sun">Test entry</comment>
            <comment lang="en" day="Wed">Test entry 2</comment>
            <comment lang="de">Testeintrag</comment>
        </add>
        <remove target="/test2.html">
            <permission type="user">
                baz
            </permission>
        </remove>
    </complex-childStruct>

This tag demonstrates complex usage of the SimpleTaglib 'childStruct' input attribute. XML input from child tags can be accessed via the '%_' hash in the code fragment returned by the handler function. This example is from the STL documentation (and slightly modified).

AUTHOR

Ken Neighbors <ken@nsds.com>

VERSION

$Id: SimpleInputAttributes.pm,v 1.1 2002/09/13 13:01:05 jwalt Exp $