I have some XHTML files. There are to do some ID sequence changes based on the prefix list given in prefix.lst containing lines like:
Step 1:
The identifiers in the files should be changed according to the example given below:
There are also has some other prefixes such as toc- and r_, which are prepended to the prefixes in the file prefix.lst, which should be changed as shown in the example below:
Step 2:
Once the identifiers are changed in all files, the old identifiers used in the values of the href attributes should be changed according to the new identifiers. Example:
Note: href attributes may contain the same identifiers multiple times.
Step 3:
Step 3 should change all aria-labelledby attributes in the same way as the id attributes above:
Can the above three steps be done by a script?
Thanks
Update on 2021-02-25:
Sorry, I made a mistake in saying that the ID sequence will be new in each file. Example:
006-9781000419320_chapter1.xhtml
007-9781000419320_chapter2.xhtml
Of course from the prefix.lst list above part: pt and chapter: c will be omitted.
I would be very grateful if anyone could help me with this.
Update on 2021-03-04:
Is it possible to create such a script? Please help me ...
Code: Select all
part:pt
chapter:c
sec:h
fig:f
table:t
box:b
ref:r
en:n
eqn:e
Step 1:
The identifiers in the files should be changed according to the example given below:
Code: Select all
id="chapter1" = id="c1"
id="chapter2" = id="c2"
id="refintro_1" = id="r1"
id="refintro_2" = id="r2"
id="ref1_1" = id="r3"
id="ref1_2" = id="r4"
Code: Select all
id="toc-chapter1" = id="c1b"
id="toc-chapter2" = id="c2b"
id="r_refintro_1" = id="r1b"
id="r_refintro_2" = id="r2b"
id="r_ref1_1" = id="r3b"
id="r_ref1_2" = id="r4b"
Step 2:
Once the identifiers are changed in all files, the old identifiers used in the values of the href attributes should be changed according to the new identifiers. Example:
Code: Select all
href="#chapter1" = href="#c1"
href="#chapter2" = href="#c2"
href="#refintro_1" = href="#r1"
href="#refintro_2" = href="#r2"
href="#ref1_1" = href="#r3"
href="#ref1_2" = href="#r4"
href="#toc-chapter1" = href="#c1b"
href="#toc-chapter2" = href="#c2b"
href="#r_refintro_1" = href="#r1b"
href="#r_refintro_2" = href="#r2b"
href="#r_ref1_1" = href="#r3b"
href="#r_ref1_2" = href="#r4b"
Step 3:
Step 3 should change all aria-labelledby attributes in the same way as the id attributes above:
Code: Select all
aria-labelledby="secintro_1" = aria-labelledby="h1"
aria-labelledby="sec1_1" = aria-labelledby="h2"
aria-labelledby="tableintro_1" = aria-labelledby="t1"
aria-labelledby="table1_1" = aria-labelledby="t2"
Thanks
Update on 2021-02-25:
Sorry, I made a mistake in saying that the ID sequence will be new in each file. Example:
006-9781000419320_chapter1.xhtml
Code: Select all
id = "sec1_1" = id = "h1"
id = "sec1_2" = id = "h2"
id = "sec1_3" = id = "h3"
Code: Select all
id = "sec2_1" = id = "h1"
id = "sec2_2" = id = "h2"
id = "sec2_3" = id = "h3"
I would be very grateful if anyone could help me with this.
Update on 2021-03-04:
Is it possible to create such a script? Please help me ...