Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using Parent Element Attribute in Prefix Rules

Participant ,
Nov 21, 2024 Nov 21, 2024

I have a parent Element with an attribute (DayNum). I want to use the value of this attribute in the prefix rules of a child element. I can see that I can reference an Attribute in the PrefixRule, but it doesn't seem to recognise an Attribute from a parent element.

In normal Context Rules, I can refer to the Attribute of the parent using ParentElement[ElementName = "Value"], but that doesn't seem to work in a PrefixRule.

Is this possible?

549
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 23, 2024 Nov 23, 2024

image.png

Translate
Community Expert ,
Nov 22, 2024 Nov 22, 2024

It should work if the EDD syntax is correct.

 

image.png

image.png

image.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 23, 2024 Nov 23, 2024

@frameexpert What would be the syntax if it's not the immediate parent, e.g. what if the Attribute is defined on the Grandparent Element and I need to reference it on the Grandchild Element?

 

I tried the following:

Prefix rules

 1. If context is: Grandchild < * < Grandparent

       Prefix: Day: <$attribute[Grandparent:Daynum]>

 

But I just get the following:

Day: 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2024 Nov 23, 2024

image.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 23, 2024 Nov 23, 2024

I must be missing something. This is my EDD:

QuintinSeegers_Personal_0-1732418885466.png

In the Structure View, I have the DayNum attribute as follows:

 

QuintinSeegers_Personal_1-1732418946649.png

and in my document, I see this:

QuintinSeegers_Personal_2-1732418964023.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 23, 2024 Nov 23, 2024
LATEST

Nevermind. I saw where I made the mistake. My syntax was wrong. It should be $attribute[AttributeName:ElementName], not $attribute[ElementName:AttributeName]. Once I corrected the syntax, it is working as expected.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines