XML : How to extract prefix from URI?

Is there approach that assembles prefix:local-name of an element by given URN and a local-name?

For example using this code:

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xstible:1.0" version="1.0">      <xsl:template match="/">          <root>          <xsl:element name="element" namespace="urn:oasis:names:tc:opendocument:xmlns:xstible:1.0">              <nested-element>Some text...</nested-element>          </xsl:element>          </root>      </xsl:template>  </xsl:stylesheet>    

What I get as result is:

  <root xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xstible:1.0">      <element xmlns="urn:oasis:names:tc:opendocument:xmlns:xstible:1.0">          <nested-element xmlns="">Some text...</nested-element>      </element>  </root>    

What I want as a result is:

  <root xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xstible:1.0">      <fo:element>          <nested-element>Some text...</nested-element>      </fo:element>  </root>    

Giving the URI to the xsl:element, the name to be magically prefixed (with the prefix that corresponds to that URI - declared in the root element), and the URI absent into the result document. I hope you understand what I am trying to achieve :)

No comments:

Post a Comment