|
9301 | 9301 | </xsl:attribute>
|
9302 | 9302 | </xsl:template>
|
9303 | 9303 |
|
| 9304 | + <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable> |
| 9305 | + |
9304 | 9306 | <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
9305 | 9307 | <xsl:copy>
|
9306 | 9308 | <xsl:apply-templates select="@*" mode="svg_update"/>
|
|
9319 | 9321 |
|
9320 | 9322 | <xsl:attribute name="width">
|
9321 | 9323 | <xsl:choose>
|
9322 |
| - <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
| 9324 | + <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' --> |
| 9325 | + <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> |
9323 | 9326 | <xsl:when test="$width != ''">
|
9324 | 9327 | <xsl:value-of select="round($width)"/>
|
9325 | 9328 | </xsl:when>
|
|
9328 | 9331 | </xsl:attribute>
|
9329 | 9332 | <xsl:attribute name="height">
|
9330 | 9333 | <xsl:choose>
|
9331 |
| - <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
| 9334 | + <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' --> |
| 9335 | + <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> |
9332 | 9336 | <xsl:when test="$height != ''">
|
9333 | 9337 | <xsl:value-of select="round($height)"/>
|
9334 | 9338 | </xsl:when>
|
|
9345 | 9349 | <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
|
9346 | 9350 | <xsl:attribute name="width">
|
9347 | 9351 | <xsl:choose>
|
9348 |
| - <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when> |
| 9352 | + <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> |
9349 | 9353 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
9350 | 9354 | </xsl:choose>
|
9351 | 9355 | </xsl:attribute>
|
|
9356 | 9360 | <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
|
9357 | 9361 | <xsl:attribute name="height">
|
9358 | 9362 | <xsl:choose>
|
9359 |
| - <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when> |
| 9363 | + <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> |
9360 | 9364 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
9361 | 9365 | </xsl:choose>
|
9362 | 9366 | </xsl:attribute>
|
|
0 commit comments