Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels for Parts #5

Open
Kolophonium0 opened this issue Feb 10, 2022 · 3 comments
Open

Labels for Parts #5

Kolophonium0 opened this issue Feb 10, 2022 · 3 comments

Comments

@Kolophonium0
Copy link

Id would be nice, if parts could have some kind of label.

@MartinFechner
Copy link
Contributor

Thanks for this idea. Can you give an example?

@Kolophonium0
Copy link
Author

Kolophonium0 commented Feb 16, 2022

@MartinFechner
Im creating an edition using Javascript wich uses parts to avoid always loading the whole document/object. Now i want to let the User know where in the document they are by displaying a title like <object label>/<partid> but then you are restricted by the ID format. Sure it would be possible to use a child node of the part for that purpose, but it would be more convenient to use the partlist returned by the api for that. Maybe having as partlist a list of objects like [{partID: partLabel}, ...].

@MartinFechner
Copy link
Contributor

To return also a label one can add a xpath definition for label to the parts definition in the appconf.xml. Then it can be used here:

let $ids := util:eval-inline($d-map?xml, $xpath)

and here:

let $ids := util:eval-inline($xml, $xpath)

with something like

 let $labels := util:eval-inline($xml, $label-xpath) 

Beware: The recursive funktion list-part-ids isn't very performant if a large document is used in combination with a three-or-more level hierarchy (like: book1.chapter1.section1). It maybe becomes worse if the label evaluation is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants