Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7878959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:47:47+00:00 2026-06-03T03:47:47+00:00

I’m exporting an XML file from InDesign. The text in this file contains superscripts

  • 0

I’m exporting an XML file from InDesign. The text in this file contains superscripts referring to a specific grammatical concept; however, these superscripts are exported as text in the XML file. I need to write an XSLT so that when it’s applied to the InDesign file it will simply add a little tag to the superscript.

This is how it’s exported:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root>
<Content>
<PhraseNative aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="260.5">
<Phrase>    1.  Mark is1a playing2 videogames.</Phrase> 
</PhraseNative>
</Content>
</Root>  

This should be the final code.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root>
<Content>
<PhraseNative aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="260.5">
<Phrase>    1.  Mark is<tag>1a</tag> playing<tag>2</tag> videogames.</Phrase> 
</PhraseNative>
</Content>
</Root>

These tags would always appear whenever a number and a letter are the two or three last digits of a string. Sometimes it will be only a number. The output doesn’t change at all. This is just so the tags are not lost when exported back into a web page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:47:49+00:00Added an answer on June 3, 2026 at 3:47 am

    You tagged the question with XSLT 2.0, so here’s a 2.0 option.

    Note: I had to add a dummy xmlns for the aid prefix.

    Also, you’ll most likely need to refine the regex, but this should get you started.

    XML Input

    <Root>
      <Content>
        <PhraseNative aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="260.5" xmlns:aid="somexmlns">
          <Phrase>    1.  Mark is1a playing2 videogames.</Phrase> 
        </PhraseNative>
      </Content>
    </Root>
    

    XSLT 2.0

    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:aid="somexmlns">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="Phrase">
        <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <xsl:analyze-string select="." regex="([a-z]+)([0-9]+[a-z]*)">
            <xsl:matching-substring>
              <xsl:value-of select="regex-group(1)"/>
              <tag>
                <xsl:value-of select="regex-group(2)"/>    
              </tag>
            </xsl:matching-substring>
            <xsl:non-matching-substring><xsl:value-of select="."/></xsl:non-matching-substring>
          </xsl:analyze-string>
        </xsl:copy>
      </xsl:template>
    
    </xsl:stylesheet>
    

    XML Output

    <Root>
       <Content>
          <PhraseNative xmlns:aid="somexmlns" aid:table="cell" aid:crows="1" aid:ccols="1"
                        aid:ccolwidth="260.5">
             <Phrase>    1.  Mark is<tag>1a</tag> playing<tag>2</tag> videogames.</Phrase>
          </PhraseNative>
       </Content>
    </Root>
    

    Tested using Saxon-HE 9.3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have a reasonable size flat file database of text documents mostly saved in
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.