Metadata editor
[redakcja.git] / src / wlxml / templates / wlxml / wl2html.xsl
index 91d41c4..c3af0ff 100644 (file)
         </xsl:if>
 
         <xsl:for-each select="@*">
-            <xsl:variable name="id" select="generate-id()" />
-            <xsl:attribute name="x-attr-value-{$id}"><xsl:value-of select="."/></xsl:attribute>
-            <xsl:attribute name="x-attr-name-{$id}"><xsl:value-of select="local-name()"/></xsl:attribute>
-            <xsl:choose>
-               <xsl:when test="namespace-uri()">
-                <xsl:attribute name="x-attr-ns-{$id}"><xsl:value-of select="namespace-uri()"/></xsl:attribute>
-                               </xsl:when>
-                               <!-- if the element belongs to default namespace and attribut has no namespace -->
-               <xsl:when test="not(namespace-uri(.))">
-                               <xsl:attribute name="data-wlf-{local-name()}"><xsl:value-of select="."/></xsl:attribute>
-                               </xsl:when>
-                       </xsl:choose>               
+
+          <xsl:choose>
+            {% for namespace, prefix in namespaces.items %}
+            <xsl:when test="namespace-uri() =  '{{ namespace }}'">
+              <xsl:attribute name="x-a-{{ prefix }}-{local-name()}">
+                <xsl:value-of select="."/>
+              </xsl:attribute>
+            </xsl:when>
+            {% endfor %}
+
+            <xsl:otherwise>
+              <xsl:variable name="id" select="generate-id()" />
+              <xsl:attribute name="x-attr-value-{$id}"><xsl:value-of select="."/></xsl:attribute>
+              <xsl:attribute name="x-attr-name-{$id}"><xsl:value-of select="local-name()"/></xsl:attribute>
+              <xsl:attribute name="x-attr-ns-{$id}"><xsl:value-of select="namespace-uri()"/></xsl:attribute>
+           </xsl:otherwise>
+         </xsl:choose>               
+
         </xsl:for-each>
     </xsl:template>