Loading TOC...

MarkLogic 9 Product Documentation
sc:attribute-decl

sc:attribute-decl(
   [$arg as item()]
) as attribute-decl()?

Summary

Returns the attribute declaration of item, as a schema component, if any. If the item has no attribute declaration, the empty sequence is returned. The context item is used if no argument is given.

Parameters
arg The item whose attribute declaration is to be returned.

Example

declare namespace xh="http://www.w3.org/1999/xhtml";

<decl>{sc:attribute-decl(
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>Example</title></head>
    <body><p class="example">Example</p></body>
  </html>//xh:p/@class)}</decl>;

  =>
<decl>
  <xs:attribute name="class" type="xs:NMTOKENS" 
                xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
</decl>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.