Project

Profile

Help

Namespace Question - Sorry to post here

Added by Anonymous about 19 years ago

Legacy ID: #3401690 Legacy Poster: Curtis (cdfisher07)

Michael, Sorry to have to bother your Saxon forum again with another XSLT question, but I am still unable to communicate with the mulberry list. I found a reference to this on page 51 in your XSLT 2.0 book, but I was unable to connect it to any solution. I have the following Subversion file I am trying to create a version report with: <?xml version="1.0" encoding="utf-8"?> <wc-entries xmlns="svn:"> <entry committed-rev="3269" name="" committed-date="2005-10-26T20:10:00.200172Z" url="http://mocha.xxx.com/svn/xxx/development/XXXApplication/trunk" last-author="uxxx" kind="dir" uuid="8e7ffa69-30e3-0310-bba8-f333d58a7854" revision="3269"/> <entry name="build" kind="dir"/> <entry name="META-INF" kind="dir"/> <entry name="mockups" kind="dir"/> <entry name="context" kind="dir"/> <entry name="src" kind="dir"/> </wc-entries> ...and the xmlns=svn: keeps me from accessing the attributes on the entry element. I cannot seem to figure out how to access the elements nor their attributes because of the namspace in the xml. If I take out the namespace declaration, then everything is accessable I have tried including it in the xsl file as show below: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svn:="http://com.kcp.org/1999/XSL/Transform"> But am still unable to access it. I have accessed nodes before using namespaces, but I have never came across the namespace being declared in the xml file as such (it's an automatically generated file) and I don't understand the affect it has on attributes for elements it encompases. Can you demonstrate how I would access the attributes in this example? The xxx was placed in the xml to protect sensitive information for the US Government client I work for. Thank you, Curtis Fisher


Replies (2)

RE: Namespace Question - Sorry to post here - Added by Anonymous about 19 years ago

Legacy ID: #3402119 Legacy Poster: Michael Kay (mhkay)

Declare xmlns:s="svn:" in the stylesheet, and access the element/attribute as /s:wcs-entries/s:entry/@name svn: is not actually a legal URI and some XML tools will complain about it, but Saxon's not fussy. You can of course use any prefix you like. Michael Kay

RE: Namespace Question - Sorry to post here - Added by Anonymous about 19 years ago

Legacy ID: #3402231 Legacy Poster: Curtis (cdfisher07)

Thanks Michael, I appreciate the help.

    (1-2/2)

    Please register to reply