Wednesday, 4 February 2015

Xsl transforms correctly choosing children but not on ancestor in indesign?



I am experiencing a strange problem with xsl:



<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()|*[not(self::table)]"/>
</xsl:copy>
</xsl:template>

<xsl:template match="@value">
<xsl:attribute name="value">
<xsl:value-of select="translate(.,'&#xd;','&#xa;')"/>
</xsl:attribute>
</xsl:template>

<xsl:template match="text">
<xsl:copy>
<xsl:attribute name="value">
<xsl:apply-templates/>
</xsl:attribute>
</xsl:copy>
</xsl:template>


<xsl:template match="b">
<xsl:text>[b]</xsl:text>
<xsl:apply-templates/>
<xsl:text>[/b]</xsl:text>
</xsl:template>


<xsl:template match="i">
<xsl:text>[i]</xsl:text>
<xsl:apply-templates/>
<xsl:text>[/i]</xsl:text>
</xsl:template>
<xsl:template match="@href"/>


My Xml looks like this:



<medium>
<sheets>
<sheet>
<site>
All Elements
</site>
</sheet>
</sheets>
</medium>


A <text-area> tag will look like this:



<text-area>
<text>
this is the <b>normal</b> indesign content
</text>
</text-area>.


After xsl:



<text-area>
<text value="this is the [b]normal[/b] indesign content"/>
</text-area>


Now the Problem:


When I export it in indesign and choose sheets, sheet, site or any other element where <text-area> is a child, it exports it as:



<text-area>
<text value="this is the [b]normal[/b] indesign content"/>
</text-area>


ONLY when I choose medium it will look like this:



<text-area>
<text value="this is the normal indesign content">
this is the <b>normal</b> indesign content
</text>
</text-area>


Why is this happening? I have NO idea... Why is it working on every other element other than "medium"?


Thank you in advance!


No comments:

Post a Comment