cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Use of the ACL command link_idref_attr_name()

BobSpangenburg
6-Contributor

Use of the ACL command link_idref_attr_name()

I'm trying to get the name of the attribute that is defined as a type XREFID in the current element. I've come up with the command:

$idrefName = link_idref_attr_name( current_tag() ) ;

The problem is that I'm getting a null reply even whenthe cursor is next to an XREF element.I have no doubt it has "xrefid" defined as an XREFID type attribute.

The opposite of the function, shown here, works fine. In fact, it even lists the XREF element in the array assuming one is in the tree.

$idrefCount = oid_find_child_attrs( oid_current_tag(), $idrefChild, '', '', 0x20 ) ; # those are single quotes defining a null string

Has anyone else run into this problem, or am I doing something wrong?

Thanks,

Bob

2 REPLIES 2

Hi Bob,

I don't know if these problems/gotchas I've run into might relate or not,
but here they are: Case counts. If your attribute is alternately defined as
'id' and 'ID' in the various locations referenced, this function may fail.
The .dcf file may need to know that your link tag is a link tag. Be sure
it's defined in Specials, I think, in the DCF.

On Mon, Mar 2, 2009 at 11:24 AM, Bob Spangenburg <
-> wrote:

> I'm trying to get the name of the attribute that is defined as a type
> XREFID in the current element. I've come up with the command:
>
> $idrefName = link_idref_attr_name( current_tag() ) ;
>
> The problem is that I'm getting a null reply even when the cursor is next
> to an XREF element. I have no doubt it has "xrefid" defined as an XREFID
> type attribute.
>
> The opposite of the function, shown here, works fine. In fact, it even
> lists the XREF element in the array assuming one is in the tree.
>
> $idrefCount = oid_find_child_attrs( oid_current_tag(), $idrefChild, '', '',
> 0x20 ) ; # those are single quotes defining a null string
>
> Has anyone else run into this problem, or am I doing something wrong?
>
> Thanks,
>
> Bob
>
>

Hi Paul,

Functionally within the documents, it works fine. I'm trying to find the attribute names behind the seen for other than linking reasons. According to the help, this functionis supposed to return the name of the attribute that is defined as either a type "IDREF" or "IDREFS" by the DTD. It's not giving me the expected results.

Here's a string that I put into the command line after placing my cursor inside an element that has at least one XREF element within:

$m = oid_find_child_attrs( oid_current_tag(), $delIdrefChild, '', '', 0x20 ) ; eval "new one..." output=*; for($i=1;$i<=$m;$i++){eval "name is ".oid_name($delIdrefChild[$i])." oid is ".$delIdrefChild[$i]." attr name is >".link_idref_attr_name(oid_name($delIdrefChild[$i]))."<" output=>*};

Without getting deep into this, near the end of the eval string is the function in question. The first line of the output is representing the first IDREF hit and might be like this:

name is xref oid is (6159,1,53) attr name is ><

You'll notice that there is nothing between the two brackets. It sees the "XREF" within the current tag as having and attribute of type IDREF, which may be a <para> tag. However, this function is not seeing that attribute, or at least not returning it.

Thanks again.

In Reply to Paul Nagai:

Hi Bob,

I don't know if these problems/gotchas I've run into might relate or not,
but here they are: Case counts. If your attribute is alternately defined as
'id' and 'ID' in the various locations referenced, this function may fail.
The .dcf file may need to know that your link tag is a link tag. Be sure
it's defined in Specials, I think, in the DCF.

On Mon, Mar 2, 2009 at 11:24 AM, Bob Spangenburg <
@-> wrote:

> I'm trying to get the name of the attribute that is defined as a type
> XREFID in the current element. I've come up with the command:
>
> $idrefName = link_idref_attr_name( current_tag() ) ;
>
> The problem is that I'm getting a null reply even when the cursor is next
> to an XREF element. I have no doubt it has "xrefid" defined as an XREFID
> type attribute.
>
> The opposite of the function, shown here, works fine. In fact, it even
> lists the XREF element in the array assuming one is in the tree.
>
> $idrefCount = oid_find_child_attrs( oid_current_tag(), $idrefChild, '', '',
> 0x20 ) ; # those are single quotes defining a null string
>
> Has anyone else run into this problem, or am I doing something wrong?
>
> Thanks,
>
> Bob
>
>
Top Tags