Announcement

Collapse
No announcement yet.

Root-Element mit Attribute-Set

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Root-Element mit Attribute-Set

    Hi,

    ich möchte die statische Ausgabe des Root-Elements

    Code:
    <the-abc:Root 
        xmlns:the-abc="https://www.abc.org/THE-ABC" 
        xmlns:the-gen="https://www.abc.org/THE-GEN" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="https://www.abc.org/THE-GEN the-gen-1.2.4.xsd https://www.abc.org/THE-ABC the-abc-10.11.12.xsd">
    durch eine Deklaration mit einem Attribute-Set ersetzen

    Code:
    <xsl:element name="{$Root}" use-attribute-sets="root">
    
    <xsl:attribute-set name="root">
        <xsl:attribute name="xmlns:the-abc">https://www.abc.org/THE-ABC</xsl:attribute>
        <xsl:attribute name="xmlns:the-gen">https://www.abc.org/THE-GEN</xsl:attribute>
        <xsl:attribute name="xmlns:xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
        <xsl:attribute name="xsi:schemaLocation">https://www.abc.org/THE-GEN the-gen-2.4.xsd https://www.abc.org/THE-ABC the-abc-10.1.xsd</xsl:attribute>
    </xsl:attribute-set>
    Alle Namespaces sind im XSLT ordentlich definiert, sie sind also im Rahmen des XSLT bekannt, und dennoch erhalte ich bei der Transformation beim ersten Attribut den Fehler "Unknown namespace prefix".

    Woran könnte das liegen?
    --
    Cheers Vince

  • #2
    Im XSLT/XPath-Datenmodell ist eine Namensraumdeklaration kein Attribut, also sind
    Code:
        <xsl:attribute name="xmlns:the-abc">https://www.abc.org/THE-ABC</xsl:attribute>
        <xsl:attribute name="xmlns:the-gen">https://www.abc.org/THE-GEN</xsl:attribute>
        <xsl:attribute name="xmlns:xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
    alle drei nicht korrekt. Saxon 6.5.5 meldet dabei "Invalid attribute name: xmlns:the-abc".

    Comment


    • #3
      Ah!

      Hi,

      ah, okay - das wußte ich nicht. Ich kann also kein Root-Element mit Namespace-Deklarationen über ein attribute set generieren - auch gut, dann halt "manuell".

      Merci!
      --
      Cheers Vince

      Comment

      Working...
      X