tag-named-with-attr ( tag tag-name attr-value attr-name -- matching-tag ) (original) (raw)

tag-named-with-attr ( tag tag-name attr-value attr-name -- matching-tag )

Vocabulary
xml.traversal

Inputs

tag an XML tag or document
tag-name an XML name or string representing the name
attr-value a string representing the attribute value
attr-name a string representing the attribute name

Outputs

matching-tag a tag

Word description
Finds the first tag with matching name with the corresponding attribute name and value which is the direct child of the given tag.

See also
tag-named

Definition

USING: kernel sequences ;

IN: xml.traversal

: tag-named-with-attr
( tag tag-name attr-value attr-name -- matching-tag )
[ tags-named ] 2dip [ tag-with-attr? ] 2curry find nip ;