Copy link to clipboard
Copied
Hi,
I have a xml in which I have data as
<p style="text-align: left;"><strong>DESCRIPTION</strong></p>
In this,
<strong>DESCRIPTION</strong>. Here I have applied Character style using Script and displayed it as DESCRIPTION.Then, I have this tag , <p style="text-align: left;"> for left alignment.I have to apply left alignment by removing the tag.Is it possible to apply left alignment from the tag, in InDesign using script?Please guide me.
Regards,
Revathi
Copy link to clipboard
Copied
You can apply paragraph style (which contains the alignment you want) via
script.
Try to find () separating them in
groups using the (). And then change to $2 (which is your second group /
your content) and apply the correct para style you want. Use grep
find/change script methods.
Copy link to clipboard
Copied
All you need is use map tags to styles in the tags panel…
Copy link to clipboard
Copied
Hi Corullon and Loic,
Thanks for your response.I have got it.But now I have a tag for alignment as <p style="text-align: left;"> .I am able to only map tags with <p> and so but I am unable to apply my styles for tags, <p style="text-align: left;"> for alignment.What do I have to do now?
Thanks,
Revathi
Copy link to clipboard
Copied
I would do using a script, as I mentioned.
But comparing my first found group with a string. If the string is the same
as found, apply the paragraph aligning to the left. Else, applying another
one or doing nothing.
Am I clear?
Em 20 de mai de 2017 8:48 AM, "revathiv80720177" <forums_noreply@adobe.com>
escreveu:
Adobe Community <https://forums.adobe.com/?et=watches.email.thread>
Alignment in InDesign using Scripts
resposta de revathiv80720177
<https://forums.adobe.com/people/revathiv80720177?et=watches.email.thread>
em InDesign Scripting - Visualize a discussão completa
<https://forums.adobe.com/message/9526806?et=watches.email.thread#9526806>
Copy link to clipboard
Copied
Hi Corullon and Loic,
I have to apply paragraph styles to tags in xml while importing xml. Now I can apply styles only for tags <B> and so.But for alignment I have tags as <P style="text-align: left;"> or <P align =center> ,in xml.I am mapping tags to styles as <B stylename="Bold Style" />.But how shall I map my alignment tag to style, <P style="text-align: left;"> or <P align =center>.I tried to map it as <P align center stylename ="left align">.But it was invalid mapping.How shall I map my alignment tag to styles.
Regards,
Revathi V
Copy link to clipboard
Copied
A solution would have been to use XSLT and namespaced attributes such aid:pstyle and aid:cstyle so a node can call a specific text style on import.
Once that said, I gave this a try yesterday but although my xsl worked fine on Oxygen plus my transformed XML nicely injected in InDesign. It just failed when the transformation occured inside indesign.
Obviously the style="text-align: left;" syntax isn't properly understood by the inner xslt engine 😕
Copy link to clipboard
Copied
Hi Loic,
Thank you for your response.Is there any possibility to apply this tag for alignment or I have to change the tag in xml.Guide me.
Regards,
Revathi V
Copy link to clipboard
Copied
I thought i just did. if you need styles applied on import, and given that you can't Map a same node with différent styles, then the solution is change the xml structure so either tag names are changed or use the namespaced aid:pstyle attribute.