|
430 | 430 | <xsl:variable name="id" select="ancestor::product/@productid"/> |
431 | 431 | <xsl:variable name="ver" select="@setid"/> |
432 | 432 | <xsl:variable name="subpath" select="concat($id, '/', $ver, '.xml')"/> |
| 433 | +<!-- <xsl:variable name="" select=""/>--> |
433 | 434 |
|
434 | 435 | <xsl:variable name="content"> |
435 | 436 | <docset xmlns:xi="http://www.w3.org/2001/XInclude"> |
|
440 | 441 | <xsl:otherwise> |
441 | 442 | <xsl:apply-templates select="@*|node()[not(self::external)]" /> |
442 | 443 |
|
443 | | - <xsl:if test="external/link[not(starts-with(language/url/@href, 'https://'))]"> |
444 | | - <xsl:call-template name="docset-without-builddocs" ></xsl:call-template> |
| 444 | + <xsl:if test="external/link[not(starts-with(language/url/@href, 'https://')) |
| 445 | + and not(language/url/@format = 'pdf')]"> |
| 446 | + <xsl:call-template name="docset-without-builddocs" /> |
445 | 447 | </xsl:if> |
446 | 448 |
|
447 | | - <xsl:if test="external/link[starts-with(language/url/@href, 'https://')]"> |
| 449 | + <xsl:if test="external/link[starts-with(language/url/@href, 'https://') |
| 450 | + or language/url/@format = 'pdf']"> |
448 | 451 | <external> |
449 | | - <xsl:apply-templates select="external/link[starts-with(language/url/@href, 'https://')]" mode="external-link"/> |
| 452 | + <xsl:apply-templates select="external/link[starts-with(language/url/@href, 'https://') |
| 453 | + or language/url/@format = 'pdf']" mode="external-link"/> |
450 | 454 | </external> |
451 | 455 | </xsl:if> |
452 | 456 | </xsl:otherwise> |
|
486 | 490 | <xsl:template name="docset-without-builddocs"> |
487 | 491 | <resources> |
488 | 492 | <git remote="https://TODO" /> |
489 | | - <xsl:apply-templates select="external[link[not(starts-with(language/url/@href, 'https://'))]]" |
| 493 | + <xsl:apply-templates select="external[link[not(starts-with(language/url/@href, 'https://')) and not(language/url/@format = 'pdf')]]" |
490 | 494 | mode="builddocs" /> |
491 | 495 | </resources> |
492 | 496 | </xsl:template> |
|
495 | 499 | <xsl:template match="docset/external" mode="builddocs"> |
496 | 500 | <locale lang="en-us"> |
497 | 501 | <branch>main</branch> |
498 | | - <xsl:apply-templates select="link[not(starts-with(language/url/@href, 'https://'))]" mode="builddocs" /> |
| 502 | + <xsl:apply-templates select="link[not(starts-with(language/url/@href, 'https://')) and not(language/url/@format = 'pdf')]" mode="builddocs" /> |
499 | 503 | </locale> |
500 | | - <xsl:if test="link[not(starts-with(language/url/@href, 'https://')) and @lang != 'en-us']"> |
| 504 | + <xsl:if test="link[not(starts-with(language/url/@href, 'https://')) and not(language/url/@format = 'pdf') and @lang != 'en-us']"> |
501 | 505 | <xsl:message>TODO: Found non-English links in docset/external</xsl:message> |
502 | 506 | </xsl:if> |
503 | 507 | </xsl:template> |
504 | 508 |
|
505 | 509 | <xsl:template match="link" mode="external-link"> |
506 | 510 | <link> |
507 | | - <xsl:copy-of select="@category|@gated|@titleformat"/> |
| 511 | + <xsl:copy-of select="@gated|@titleformat|@category"/> |
| 512 | + <!--<xsl:choose> |
| 513 | + <xsl:when test="@category"> |
| 514 | + <xsl:copy-of select="@category"/> |
| 515 | + </xsl:when> |
| 516 | + <xsl:otherwise> |
| 517 | + <xsl:attribute name="category">TODO</xsl:attribute> |
| 518 | + </xsl:otherwise> |
| 519 | + </xsl:choose>--> |
| 520 | + |
508 | 521 | <xsl:for-each select="language/url"> |
509 | 522 | <url> |
510 | 523 | <xsl:copy-of select="@href|@format"/> |
|
520 | 533 | <xsl:otherwise>en-us</xsl:otherwise> |
521 | 534 | </xsl:choose> |
522 | 535 | </xsl:attribute> |
523 | | - <title><xsl:value-of select="@title"/></title> |
| 536 | + <xsl:if test="@title"> |
| 537 | + <title><xsl:value-of select="@title"/></title> |
| 538 | + </xsl:if> |
| 539 | + <p>TODO</p> |
524 | 540 | </desc> |
525 | 541 | </xsl:for-each> |
526 | 542 | </descriptions> |
527 | 543 | </link> |
528 | 544 | </xsl:template> |
529 | 545 |
|
530 | 546 | <xsl:template match="link" mode="builddocs"> |
531 | | - <xsl:variable name="href" select="language[@lang='en-us']/url/@href"/> |
| 547 | + <xsl:variable name="url" select="language[@lang='en-us']/url"/> |
| 548 | + <xsl:variable name="href" select="$url/@href"/> |
| 549 | + <xsl:variable name="format" select="$url/@format"/> |
| 550 | + |
532 | 551 | <!-- Extract product ID from URL like /product/docset/... --> |
533 | | - <xsl:variable name="pid" select="substring-before(substring-after($href, '/'), '/')"/> |
| 552 | + <xsl:variable name="pid"> |
| 553 | + <xsl:choose> |
| 554 | + <xsl:when test="starts-with($href, '/')"> |
| 555 | + <xsl:value-of select="substring-before(substring-after($href, '/'), '/')"/> |
| 556 | + </xsl:when> |
| 557 | + <xsl:when test="contains($href, 'external-tree')"> |
| 558 | + <!-- href="external-tree/en-us/liberty/..." --> |
| 559 | + <xsl:value-of select="substring-before(substring-after(substring-after($href, 'external-tree/'), '/'), '/')"/> |
| 560 | + </xsl:when> |
| 561 | + <xsl:otherwise> |
| 562 | + <xsl:value-of select="ancestor::product/@productid"/> |
| 563 | + </xsl:otherwise> |
| 564 | + </xsl:choose> |
| 565 | + </xsl:variable> |
534 | 566 |
|
535 | 567 | <xsl:variable name="abbrev" select="$config/product[@id=$pid]/@idabbrev"/> |
536 | 568 |
|
|
545 | 577 | </xsl:choose> |
546 | 578 | </xsl:variable> |
547 | 579 |
|
| 580 | + <xsl:variable name="docset_from_url"> |
| 581 | + <xsl:choose> |
| 582 | + <xsl:when test="starts-with($href, '/')"> |
| 583 | + <xsl:variable name="after_pid" select="substring-after(substring-after($href, '/'), '/')"/> |
| 584 | + <xsl:choose> |
| 585 | + <xsl:when test="contains($after_pid, '/')"> |
| 586 | + <xsl:value-of select="substring-before($after_pid, '/')"/> |
| 587 | + </xsl:when> |
| 588 | + <xsl:otherwise> |
| 589 | + <xsl:value-of select="$after_pid"/> |
| 590 | + </xsl:otherwise> |
| 591 | + </xsl:choose> |
| 592 | + </xsl:when> |
| 593 | + <xsl:when test="contains($href, 'external-tree')"> |
| 594 | + <xsl:variable name="after_pid" select="substring-after(substring-after(substring-after($href, 'external-tree/'), '/'), '/')"/> |
| 595 | + <xsl:choose> |
| 596 | + <xsl:when test="contains($after_pid, '/')"> |
| 597 | + <xsl:value-of select="substring-before($after_pid, '/')"/> |
| 598 | + </xsl:when> |
| 599 | + <xsl:otherwise> |
| 600 | + <xsl:value-of select="$after_pid"/> |
| 601 | + </xsl:otherwise> |
| 602 | + </xsl:choose> |
| 603 | + </xsl:when> |
| 604 | + <xsl:otherwise> |
| 605 | + <xsl:value-of select="ancestor::docset/@setid"/> |
| 606 | + </xsl:otherwise> |
| 607 | + </xsl:choose> |
| 608 | + </xsl:variable> |
| 609 | + |
| 610 | + <xsl:variable name="docset_clean"> |
| 611 | + <xsl:choose> |
| 612 | + <xsl:when test="contains($docset_from_url, '.')"> |
| 613 | + <xsl:value-of select="substring-before($docset_from_url, '.')"/> |
| 614 | + </xsl:when> |
| 615 | + <xsl:otherwise> |
| 616 | + <xsl:value-of select="$docset_from_url"/> |
| 617 | + </xsl:otherwise> |
| 618 | + </xsl:choose> |
| 619 | + </xsl:variable> |
| 620 | + |
548 | 621 | <xsl:variable name="filename"> |
549 | 622 | <xsl:call-template name="substring-after-last"> |
550 | 623 | <xsl:with-param name="string" select="$href"/> |
|
566 | 639 | <xsl:variable name="id"> |
567 | 640 | <xsl:call-template name="generate.id"> |
568 | 641 | <xsl:with-param name="product.idabbrev" select="$product.idabbrev"/> |
569 | | - <xsl:with-param name="docset" select="ancestor::docset/@setid"/> |
| 642 | + <xsl:with-param name="docset" select="$docset_clean"/> |
570 | 643 | <xsl:with-param name="dc" select="$doc"/> |
571 | 644 | </xsl:call-template> |
572 | 645 | </xsl:variable> |
|
0 commit comments