|
12648 | 12648 | </xsl:attribute>
|
12649 | 12649 | </xsl:template>
|
12650 | 12650 |
|
| 12651 | + <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable> |
| 12652 | + |
12651 | 12653 | <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
12652 | 12654 | <xsl:copy>
|
12653 | 12655 | <xsl:apply-templates select="@*" mode="svg_update"/>
|
|
12666 | 12668 |
|
12667 | 12669 | <xsl:attribute name="width">
|
12668 | 12670 | <xsl:choose>
|
12669 |
| - <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
| 12671 | + <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' --> |
| 12672 | + <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
12670 | 12673 | <xsl:when test="$width != ''">
|
12671 | 12674 | <xsl:value-of select="round($width)"/>
|
12672 | 12675 | </xsl:when>
|
|
12675 | 12678 | </xsl:attribute>
|
12676 | 12679 | <xsl:attribute name="height">
|
12677 | 12680 | <xsl:choose>
|
12678 |
| - <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
| 12681 | + <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' --> |
| 12682 | + <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
12679 | 12683 | <xsl:when test="$height != ''">
|
12680 | 12684 | <xsl:value-of select="round($height)"/>
|
12681 | 12685 | </xsl:when>
|
|
12692 | 12696 | <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
|
12693 | 12697 | <xsl:attribute name="width">
|
12694 | 12698 | <xsl:choose>
|
12695 |
| - <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
| 12699 | + <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
12696 | 12700 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
12697 | 12701 | </xsl:choose>
|
12698 | 12702 | </xsl:attribute>
|
|
12703 | 12707 | <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
|
12704 | 12708 | <xsl:attribute name="height">
|
12705 | 12709 | <xsl:choose>
|
12706 |
| - <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
| 12710 | + <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
12707 | 12711 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
12708 | 12712 | </xsl:choose>
|
12709 | 12713 | </xsl:attribute>
|
|
0 commit comments