How to access attributes in DocumentAssembler

Home Forums WordprocessingML How to access attributes in DocumentAssembler

This topic contains 2 replies, has 2 voices, and was last updated by  illuzioner 8 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3503

    illuzioner
    Participant

    In DocumentAssembler in the power tools we can access attributes that are part of a designated list.

    For a table, we start a list within a content control like this:
    <Table Select=”./Orders/Order” />
    And then we can use another control to access the attribute that has the above XPath:
    <Content Select=”@Number”/>

    We know then that the xml looks similar to:
    <Orders>
    <Order Number=”1″/>
    </Orders>

    But how do I access the attribute if I have xml like this:
    <Client FirstName=”John” LastName=”Smith”/>

    I tried this
    <Content Select =”./Client[@FirstName]”/>
    but it didn’t produce anything … but it also didn’t complain.

    Is there a way to do this?

    #3504

    Eric White
    Keymaster

    Hi,

    DocumentAssembler was not designed to take as input any arbitrary XML. There are many forms of XML that are not appropriate for it. Instead, for this version of DocumentAssembler, my recommended approach is that you reformulate your XML so that your data is in the form that is accessible by DocumentAssembler.

    The key benefit of DocumentAssembler is not in its general purpose way of accessing XML, but is instead, in the way that you can take data from compatible XML and combine to formulate a valid, correctly formatted DOCX. Attempting to do more than this was beyond the scope of the project.

    -Eric

    #3505

    illuzioner
    Participant

    Okay, thank you. I saw you had used attributes in one case and thought maybe you allowed for them elsewhere. I’ll reformat my XML.

    Thanks again.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.