Changeset b1a51ac1 for stylesheets/lfs-xsl/docbook-xsl-1.78.1/lib/lib.xsl
- Timestamp:
- 12/10/2013 11:37:38 PM (11 years ago)
- Branches:
- 7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
- Children:
- 112db9d
- Parents:
- f2a5108
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
stylesheets/lfs-xsl/docbook-xsl-1.78.1/lib/lib.xsl
rf2a5108 rb1a51ac1 1 <?xml version="1.0" encoding="ASCII"?>1 <?xml version="1.0"?> 2 2 <!-- ******************************************************************** 3 $Id $3 $Id: lib.xweb 9040 2011-08-19 21:51:47Z bobstayton $ 4 4 ******************************************************************** 5 5 … … 411 411 <xsl:param name="return" select="'A'"/> 412 412 413 <xsl:choose> 414 <xsl:when test="contains($uriA, '/') and contains($uriB, '/') and substring-before($uriA, '/') = substring-before($uriB, '/')"> 413 <!-- Resolve any ../ in the path --> 414 <xsl:variable name="trimmed.uriA"> 415 <xsl:call-template name="resolve.path"> 416 <xsl:with-param name="filename" select="$uriA"/> 417 </xsl:call-template> 418 </xsl:variable> 419 420 <xsl:variable name="trimmed.uriB"> 421 <xsl:call-template name="resolve.path"> 422 <xsl:with-param name="filename" select="$uriB"/> 423 </xsl:call-template> 424 </xsl:variable> 425 426 <xsl:choose> 427 <xsl:when test="contains($trimmed.uriA, '/') and contains($trimmed.uriB, '/') and substring-before($trimmed.uriA, '/') = substring-before($trimmed.uriB, '/')"> 415 428 <xsl:call-template name="trim.common.uri.paths"> 416 <xsl:with-param name="uriA" select="substring-after($ uriA, '/')"/>417 <xsl:with-param name="uriB" select="substring-after($ uriB, '/')"/>429 <xsl:with-param name="uriA" select="substring-after($trimmed.uriA, '/')"/> 430 <xsl:with-param name="uriB" select="substring-after($trimmed.uriB, '/')"/> 418 431 <xsl:with-param name="return" select="$return"/> 419 432 </xsl:call-template> … … 422 435 <xsl:choose> 423 436 <xsl:when test="$return = 'A'"> 424 <xsl:value-of select="$ uriA"/>437 <xsl:value-of select="$trimmed.uriA"/> 425 438 </xsl:when> 426 439 <xsl:otherwise> 427 <xsl:value-of select="$ uriB"/>440 <xsl:value-of select="$trimmed.uriB"/> 428 441 </xsl:otherwise> 429 442 </xsl:choose> … … 431 444 </xsl:choose> 432 445 </xsl:template> 446 <xsl:template name="resolve.path"> 447 <xsl:param name="filename" select="''"/> 448 <xsl:choose> 449 <!-- Leading .. are not eliminated --> 450 <xsl:when test="starts-with($filename, '../')"> 451 <xsl:value-of select="'../'"/> 452 <xsl:call-template name="resolve.path"> 453 <xsl:with-param name="filename" select="substring-after($filename, '../')"/> 454 </xsl:call-template> 455 </xsl:when> 456 <xsl:when test="contains($filename, '/../')"> 457 <xsl:call-template name="resolve.path"> 458 <xsl:with-param name="filename"> 459 <xsl:call-template name="dirname"> 460 <xsl:with-param name="filename" select="substring-before($filename, '/../')"/> 461 </xsl:call-template> 462 <xsl:value-of select="substring-after($filename, '/../')"/> 463 </xsl:with-param> 464 </xsl:call-template> 465 </xsl:when> 466 <xsl:otherwise> 467 <xsl:value-of select="$filename"/> 468 </xsl:otherwise> 469 </xsl:choose> 470 </xsl:template> 471 472 <xsl:template name="dirname"> 473 <xsl:param name="filename" select="''"/> 474 <xsl:if test="contains($filename, '/')"> 475 <xsl:value-of select="substring-before($filename, '/')"/> 476 <xsl:text>/</xsl:text> 477 <xsl:call-template name="dirname"> 478 <xsl:with-param name="filename" select="substring-after($filename, '/')"/> 479 </xsl:call-template> 480 </xsl:if> 481 </xsl:template> 482 433 483 434 484 <xsl:template name="trim.text"> … … 479 529 480 530 </xsl:stylesheet> 531
Note:
See TracChangeset
for help on using the changeset viewer.