Skip to content
bergsma edited this page Sep 26, 2014 · 5 revisions

#attr

###Convert to an attribute value or create an attribute variable.

Syntax

result = attr value ;
attr variable [= value] ; 

Arguments

  1. list value

A value of any type.

Return Value

attr result
  • character : An attr value is identical to a char value in every respect except when converting to and from XML. When converting to XML, attr variables become the attribute variables of the enclosing tag. When converting from XML, attribute variables become attr variables in the enclosing list variable.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a vector array attr result

  • character : An attr value is identical to a char value in every respect except when converting to and from XML. When converting to XML, attr variables become the attribute variables of the enclosing tag. When converting from XML, attribute variables become attr variables in the enclosing list variable.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a vector array

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: attr variable [= value] ;

  • %IDENTIFIER: 'variable' argument is not a valid identifier, literal, or reference

Description

  • None

Examples

attr name="hello" ;
put name ;
puts str name ;

list blockquote = {
  list p = {
    list b = {
      list i = "A TEXTAREA"
    }
  },
  list textarea = {
     attr rows="10",
     attr cols="40",
     "This is some text.",
     "This is another line of text"
  }
} ;
describe blockquote ;
xdescribe blockquote ;

Related Links

char
xml
xparse
xdescribe

Clone this wiki locally