Process User-Defined Tags

Subroutine Name Executable Example Viewable Example

W3TAGGER

E3TAGGER

E3TAGGER

Description

Process user-defined tags in any text such as standard text, XML, HTML, program source etc. In special, it can be used to create a variable table in a template HTML file.

The dynamic alpha variable W3TEXT is inspected for the tag named W3NAME. All characters between the corresponding start and end tag (the 'tag content') are returned in W3VALUE. The option field W3OPTION specifies whether the current tag content should be kept or if the value W3NEWVAL should be added. The W3TAG-OPTION option specifies whether the start and end tag should be deleted from W3TEXT or not.

Usage
  1. Create a template member with any tool, for example an HTML file with Microsoft Expression Web.

  2. Add user-defined tags around the parts which you want to process further. For example around a table row:

    <MY-TAG><tr><td>$NAME$</td></tr></MY-TAG>
  3. Read the template into a Natural A-dynamic variable with the Natural Web module W3READ-RESOURCE.

  4. Process the user-defined tags in the template with W3TAGGER.

  5. Write the modified template to the output page with the Natural Web module W3TEXTDYNAMIC.

Parameters
1 W3TEXT       (A) DYNAMIC                   /* io/m : Text which contains the user-defined tags.
1 W3VALUE      (A) DYNAMIC                   /*  o/m : Tag content
1 W3NAME       (A) DYNAMIC BY VALUE          /* i /m : Tag name
1 W3TAG-OPTION (A) DYNAMIC BY VALUE OPTIONAL /* i /o : Tag-Option; possible values are:
*                                            /*        'DELETE-TAG' Delete the tag from the text (default)
*                                            /*        'KEEP-TAG'   Keep the tag in the text
1 W3OPTION     (A) DYNAMIC BY VALUE OPTIONAL /* i /o : Option; possible values are:
*                                            /*        'DELETE'     Delete the tag content from the text (default)
*                                            /*        'KEEP'       Keep the tag content in the text
*                                            /*        'REPLACE'    Replace the tag content with W3NEWVAL
*                                            /*        'INSERT'     Insert W3NEWVAL in front of the tag content
*                                            /*        'ADD'        Add W3NEWVAL behind the tag content
1 W3NEWVAL     (A) DYNAMIC BY VALUE OPTIONAL /* i /o : New tag content for W3OPTION='REPLACE', 'INSERT' or 'ADD'
1 W3MSG        (A) DYNAMIC                   /* io/m : Message. New messages are added to the end of W3MSG.
1 W3RESPONSE   (I4)                          /*  o/m : Response code; possible values are:
*                                            /*        0  ok
*                                            /*        1  Invalid option W3OPTION
*                                            /*        2  Tag not found
*                                            /*        3  End tag not found
*                                            /*        4  End tag before start tag
*                                            /*        5  No input text (W3TEXT) given
*                                            /*        6  No tag name (W3NAME) given
*                                            /*        7  Invalid tag option (W3TAG-OPTION)
How To Invoke
CALLNAT 'W3TAGGER' W3TEXT W3VALUE W3NAME W3TAG-OPTION W3OPTION W3NEWVAL W3MSG W3RESPONSE

CALLNAT 'W3TAGGER' W3TEXT W3VALUE 'MY-TAG' 'KEEP-TAG' 'DELETE' 1X W3MSG W3RESPONSE